Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-41196] Provide .debug.* sections that contain build options and properties used in the build of an image. #5254

Merged
merged 6 commits into from
Oct 20, 2022

Conversation

graalvmbot
Copy link
Collaborator

This PR will make native-image embed .debug.svm.imagebuild.* sections into an image when building with -g. This can be used to find out what options and other settings were used to build that image.

For example building native-image -Dmy.system.property=123 HelloJava -O0 -g results in an executable hellojava where the following can be used:

$ readelf -p .debug.svm.imagebuild.classpath hellojava

String dump of section '.debug.svm.imagebuild.classpath':
  [     0]  /home/pwoegere/test
$ readelf -p .debug.svm.imagebuild.arguments hellojava

String dump of section '.debug.svm.imagebuild.arguments':
  ...
  [    b1]  -H:Path=/home/pwoegere/test
  [    cd]  -H:Optimize=0
  [    db]  -H:GenerateDebugInfo=2
  [    f2]  -H:Class@explicit main-class=HelloJava
  [   119]  -H:Name@main-class lower case as image name=hellojava
  ...
$ readelf -p .debug.svm.imagebuild.java.properties  hellojava

String dump of section '.debug.svm.imagebuild.java.properties':
...
  [   1a7]  -Dmy.system.property=123
... 

@olpaw olpaw requested a review from adinn October 19, 2022 14:36
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 19, 2022
@olpaw
Copy link
Member

olpaw commented Oct 19, 2022

This PR implements #5010

Copy link
Collaborator

@adinn adinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine Paul and thanks for reorganizing the provider code so it is managed by the feature. Much neater.

Copy link
Collaborator

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM as well. Thanks @olpaw

Comment on lines +96 to +98
var accessImpl = (FeatureImpl.BeforeImageWriteAccessImpl) access;
var image = accessImpl.getImage();
var debugContext = new DebugContext.Builder(HostedOptionValues.singleton(), new GraalDebugHandlersFactory(GraalAccess.getOriginalSnippetReflection())).build();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the use of var encouraged in the GraalVM code base?
If so, I will need to keep that in mind :)

(I am personally not a fan, but that's just my personal taste)

Copy link
Member

@olpaw olpaw Oct 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if it's easy from the context to guess what type the local is or the types are rather trivial, it's fine to use var.
If the type is non-trivial and being explicit actually helps to understand the code better then not using var is recommended.

@graalvmbot graalvmbot merged commit beba41a into master Oct 20, 2022
@graalvmbot graalvmbot deleted the paw/GR-41196 branch October 20, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GR-41196] Provide .debug.* sections that contain build options and properties used in the build of an image
4 participants