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-34179] Upgrade CE debug info feature to provide information about Java types for Windows/PECOFF #3732
Conversation
@adinn looks like github does not allow me to put you on this one as reviewer 😞 |
@olpaw No worry. I'll review it anyway :-) |
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 looks ok to me modulo the 3 inline comments I made. Not that I can really comment on the intricacies of the PeCOFF records and their detailed layout.
I believe this is going to need to be modified slightly when rebased over head in order to take account of the changes made to support inline info. Specifically PrimaryEntry.getSubranges() is still being called from CVLinerecordBuilder. That has been dropped in head in favour of calling leafRangeIterator(). I don't think there us anything else needs changing though.
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVDebugInfo.java
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
@stooke The above tweak turns out to be unneeded. The upstream code was updated to use the correct iterator when the gdb inline methods patch went in. Once this PR is rebased it all fits together without any conflict. So, it appears to be ready for Oracle review and merging. @pejovica Could you please review this and help get it through the Oracle gate? |
@adinn Sure, I should be able to start with that after next week. |
@pejovica This PR is still waiting to be reviewed. will you be able to do that soon or do we need to find someone else to review it? |
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.
Hi @stooke
Great to see progress on the Windows side of CE debuginfo generation!
Please consolidate the commits. E.g. combine subsequent style related commits into one (or even better, fold them into the commit that is the origin of the style issue). Also start commit messages with uppercase. A more thorough review from @pejovica will follow.
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVDebugInfo.java
Show resolved
Hide resolved
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubrecord.java
Outdated
Show resolved
Hide resolved
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubrecord.java
Show resolved
Hide resolved
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
f435b9a
to
e24f4e9
Compare
|
2eb268c
to
4096fab
Compare
Hello @olpaw , and thank you for your review! I've started to address your concerns, and squashed many of the commits, changing the messages to start with uppercase. Please let me know if I should squash further. |
Looks much better now. Thanks! |
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.
@stooke Thanks for working on this!
Overall, the PR looks good, but there are a few more things to do. Apart from what is stated in the comments, my main concern is the design of CVTypeSectionBuilder
. In particular, I think there is no need to replace forwarding records with complete records on the fly as it only makes things harder to reason about.
Instead, I suggest establishing a few invariants that we can easily check:
- Type records should only use forwarding records for cross-referencing.
- Symbol records should only use complete records for cross-referencing (e.g., for
S_UDT
records).
This would mean that CVTypeSectionBuilder.buildClass
will still make a complete record, but while doing so it will only be able to reference forwarding records. As a result, there will be no need to track whether the construction of a complete record is in progress -- it will no longer matter as only forwarding records will be referenced, and we can make them as needed.
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/PECoffObjectFile.java
Outdated
Show resolved
Hide resolved
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubrecord.java
Outdated
Show resolved
Hide resolved
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
String externName = memberNameToCodeViewName(classEntry, f); | ||
if (cvDebugInfo.useHeapBase()) { | ||
/* REL32 offset from heap base register. */ | ||
addToSymbolSubsection(new CVSymbolSubrecord.CVSymbolRegRel32Record(cvDebugInfo, externName, typeIndex, f.getOffset(), cvDebugInfo.getHeapbaseRegister())); |
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.
Well, I don't think this can work... So I'd suggest that we drop this for now and document that we only support debugging with -H:-SpawnIsolates
.
Also note that the register
must be specified using the appropriate CV constant, such as CV_AMD64_R14
.
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.
I propose we definitely say we don't support debugging with isolates (should we emit a warning?), but I'd like to keep this code in; using pointer arithmetic (and a notepad) it is possible to make your way around even with isolates.
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.
Fixed the register constants properly.
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubrecord.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
Sorry, I just added a dummy commit to restart the public gates; should I squash that and push again? Next time I'll ping you instead. |
It's all good... just wanted you to be aware that I need to sync all commits and that there are other ways to restart gates. :) |
Duly noted. :) Should I squash my dummy commit? The PR is good ether way. |
Good! :) No need to do anything, I'll just drop the dummy commit so I don't need to restart the internal gates. |
3431d8c
to
ba6b72d
Compare
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
/* Add in size of record type and length fields. */ | ||
return estimatedSize + Short.BYTES * 2; |
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.
Well, this is not entirely true. The record size does not include the length field, only the type field. However, we really do lose 4 bytes due to the alignment requirement.
I think this could be better expressed using availableSize
(instead of estimatedSize
) as the initial value can be clearly defined
int availableSize = MAX_LF_FIELDLIST_RECORD_SIZE - CVUtil.align4(Short.BYTES) - CVUtil.align4(LF_INDEX_RECORD_SIZE);
and the rest of the code would only require a slight adjustment.
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.
@pejovica, I've refactored this to correct the calculation and alignment calculations, but I haven't moved to using 'availableSize' as I think the concept of limits is best kept to the FieldListBuilder.
If this is a showstopper, please let me know and we can discuss it.
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
2138991
to
9aa5b5b
Compare
@pejovica, thank you again for your comments. I have posted a set of changes to address them (but haven't adopted 'availableSize' for reasons given above). |
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.
@stooke I left you a few more comments, but other than that the PR looks good.
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVNames.java
Outdated
Show resolved
Hide resolved
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubrecord.java
Show resolved
Hide resolved
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
...tratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionImpl.java
Outdated
Show resolved
Hide resolved
@pejovica thank you for your review, and I'm sorry circumstances forced me to take this long to get back to this PR. I've incorporated your suggestions. Should I rebase on head? |
@stooke No worries, glad you're back!
Yes, that would be great. |
d70d1ac
to
7c10644
Compare
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeSectionBuilder.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVTypeRecord.java
Outdated
Show resolved
Hide resolved
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
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.
@stooke One last thing, can you please squash everything into one commit before I proceed with the integration.
65c365f
to
5f289af
Compare
a51643a
to
77e3a74
Compare
Excellent, thanks! |
This PR adds type information to the CodeView 4 debug information (See PR #2396). It is related to issue #2986, but is targeted to Windows and Visual Studio.
This PR is based off (and highly dependant on) the work in PR #3046.
With this patch, memory can be examined from the Visual Studio or WinDbg command line and cast to Java types as laid out by the Graal compiler. Static member variables can be referenced directly.
Caveats:
I recommend @adinn as a first reviewer for this PR, as it is based on his debug type PR.