-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Associate debug Ranges with MethodEntries #3304
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
Conversation
|
@adinn please review |
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java
Outdated
Show resolved
Hide resolved
| String paramName = uniqueDebugString(""); | ||
| FileEntry fileEntry = range.getFileEntry(); | ||
| if (fileEntry != null) { | ||
| pos = writeMethodParameterDeclaration(context, paramName, paramTypeName, false, isSpecification, buffer, pos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this if/else sequence is wrong -- but not because of anything you have done. Passing paramTypeName in place of paramName in the else branch makes no sense at all (paramName is ignored for now). The method call here should include a filename argument or null. This argument should drive the choice of abbrev code as either DW_ABBREV_CODE_method_parameter_declaration2 or DW_ABBREV_CODE_method_parameter_declaration3. It does not matter too much as we don't have a line or column number so a file name for the parameter declaration is not a lot of use. Still it needs fixing, especially as the current code makes no sense at all. I'll raise a separate issue for this.
.../src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java
Outdated
Show resolved
Hide resolved
05e7916 to
d6b6535
Compare
|
Thanks for the review @adinn . I have now resolved the issues you pointed out. |
adinn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good apart from the eclipse style check failure.
55503f9 to
45a156d
Compare
|
@olpaw could you please review this? |
917fca4 to
45a156d
Compare
|
@olpaw Any chance of this getting a review from you or someone else who can get it through the gate. I believe the latest changes are sound. |
45a156d to
753a595
Compare
|
I'm not happy with the change to remove the method notifications during presentation of the type info. Of course, method details presented by NativeImageDebugInstanceTypeInfo::methodInfoProvider and method range details presented later by NativeImageDebugInfo::codeInfoProvider ought to match up 1-1. You should never see range info for a method that has not been advertised using exactly the same classname, method name and signature as belonging to a type and vice versa. However, that's not a reason to drop one stream of data in favour of the other. The two streams of data are produced from two independent data sets created by the GraalVM image generator which are then transformed by the DebugInfoProvider code to report them using a consistent mapping of HostedXXX objects to their String identifier names. The data sets and the mapping need to be checked for consistency. It took some time to ensure the right names were used and it would be very easy for a change in the closed world analysis or compilation phase to inadvertently break it. If you are worried about the performance issues when it comes to linking range info to method info then you can always use sorting and/or hashing to speed up mapping a range to a method. The same approach should also make it quicker to verify the reverse constraint that all methods are accounted for. If that verify step is too expensive then do it in a method called under an assert so it will not get run in production. |
Following Andrew Dinn's recommendation in oracle#3304 (comment), this patch creates the necessary `MethodEntry`s for each `ClassEntry` using the methodInfoProvider, It then sorts the methods list to ensure faster lookups in the phase of linking `Range`s to `MethodEntry`s. It also adds assertions to ensure that the methods list is sorted and that there are no duplicate entries in it. Furthermore, it adds assertions to ensure that each Range can be mapped to a MethodEntry created by info provided through the methodInfoProvider.
753a595 to
40b5e8d
Compare
Following Andrew Dinn's recommendation in oracle#3304 (comment), this patch creates the necessary `MethodEntry`s for each `ClassEntry` using the methodInfoProvider, It then sorts the methods list to ensure faster lookups in the phase of linking `Range`s to `MethodEntry`s. It also adds assertions to ensure that the methods list is sorted and that there are no duplicate entries in it. Furthermore, it adds assertions to ensure that each Range can be mapped to a MethodEntry created by info provided through the methodInfoProvider.
40b5e8d to
c8bbe25
Compare
Following Andrew Dinn's recommendation in oracle#3304 (comment), this patch creates the necessary `MethodEntry`s for each `ClassEntry` using the methodInfoProvider, It then sorts the methods list to ensure faster lookups in the phase of linking `Range`s to `MethodEntry`s. It also adds assertions to ensure that the methods list is sorted and that there are no duplicate entries in it. Furthermore, it adds assertions to ensure that each Range can be mapped to a MethodEntry created by info provided through the methodInfoProvider.
c8bbe25 to
f3b1a6f
Compare
|
CI fails with: I do not see how the changes of this PR could be causing this :/. I think that the failure is irrelevant to the PR, if not please let me know. |
|
Hi Foivis, I am still not clear this is correct. I said this earlier
When I said method range I was talking about the primary ranges. Your patch seems to interpret my comment as suggesting that every subrange whose details are presented under NativeImageDebugInfo::codeInfoProvider will match up with a method presented via NativeImageDebugInstanceTypeInfo::methodInfoProvider. I don't believe that is true. Indeed, your experience with prior inline patches suggests to me that it is false. So, in class DebugInfoBase at line 266 you have this call In the case where the method does not exist you will hit the assert in ClassEntry at line 365 That is not going to be good enough. In this situation I believe you will need to create a dummy MethodEntry to represent a method that only appears inline. Also, if there is no ClassEntry for the class named in the method details then you will need to create a dummy ClassEntry for a class whose methods only ever appear inline. These will be needed later on when you want to generate inline method info as they will define the class and method to which the inline details correspond. These dummy entries will need to have DWARF info generated for them but it will be a reduced set compared to the DWARF record we see for classes and methods that are notified via NativeImageDebugInstanceTypeInfo. |
You have mentioned this concern before in #2880 (comment) but I still believe that all the info we need are provided by
Can you please point me to such an example? In any case I prefer this patch going in as is, if you agree that it doesn't break anything at the moment, and we can revisit the assertion vs insert in #2880 where we will be able to verify the assertions by running tests with inlined methods and assertions enabled. |
|
@olpaw this is rebased to master and now resolves all your comments (except the one about the empty parameter names). |
|
@zakkak I just saw that there are other places in the debuginfo sources that use |
Actually assuming to be always a |
721e760 to
8ed65a8
Compare
Resolved in 8ed65a8
I am not sure TBH. The way I tested my hypothesis was by adding an assertion in |
Thanks!
All the If you ever find situations where the above does not hold that would be a bug that needs to be fixed on our side. That said, assuming that you will find all |
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java
Outdated
Show resolved
Hide resolved
olpaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #3304 (comment)
8ed65a8 to
0ea2102
Compare
|
Alright. Looks good now. I have created an internal PR now running full gates. I'll keep you updated. |
|
|
That makes sense, but I think it doesn't answer the question we are interested in, possibly because I didn't ask properly so please let me rephrase. Our goal here is to be able to map an address range to a debuginfo method-declaration entry where the debuginfo method-declaration entry essentially contains info about where (in the source code) the method is defined, what its type is, etc. The question is if there is any chance to find a Java method through the More practically, do you think there is any chance to reach https://github.com/zakkak/mandrel/blob/0ea21026b4507d2d29908093b548a9e47361347b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java#L370 since we create method entries for each method of each class in the "universe" in https://github.com/zakkak/mandrel/blob/0ea21026b4507d2d29908093b548a9e47361347b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java#L141 ?
This single one though should be able to provide me with enough info to generate the method-declaration entry, right?
Oh the comment is too long... |
Right, unless something dodgy is going on in the backend you should not hit the
Yes. |
|
@zakkak all gates but one are passing internally. And that failing gate has nothing to do with your PR. We are working on getting this sorted. In other words ... it might take a few days before you see your changes showing up on master. |
OK, thanks for the update Paul. |
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
As of oracle/graal#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
Following Andrew Dinn's recommendation in
oracle/graal#3304 (comment), this
patch creates the necessary `MethodEntry`s for each `ClassEntry` using
the methodInfoProvider, It then sorts the methods list to ensure faster
lookups in the phase of linking `Range`s to `MethodEntry`s.
It also adds assertions to ensure that the methods list is sorted and
that there are no duplicate entries in it.
As discussed in #3290 this PR ensures that every debug
Rangeis associated with aMethodEntry. This PR will enable us to continue working on #2880 and associate the debug info for nested inline methods withMethodEntryinstances.