You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native AOT DWARF info contains many overlapping ranges #83233
This seems like it's related to inlining. If so, I would expect DW_TAG_inlined_subroutine entries, but I'm not seeing anything from the JITed code, only from the linked C++.
Activity
ghost added
untriagedNew issue has not been triaged by the area owner
I'm struggling to read the output here -- what is the error saying? What are the source mappings returned from the JIT that resulted in these DWARF ranges (or is this from variable ranges?)
The JIT does not support reporting debug information in inlinees unless rich debug information is enabled (DOTNET_RichDebugInfo=1). However, even without rich debug information things are normalized back to the root method.
Maybe ILC is emitting an incorrect DW_AT_high_pc (which is 0) for the DW_TAG_compile_unit? Is the error saying that it expected the DW_TAG_subprogram to be contained in the compile unit?
Those lexical scopes are clearly not nested correctly in the DWARF info.
The function is System.IO.Pipes.Interop+Sys:StrError. The variable ranges returned by the JIT are:
VarLocInfo count is 4
; Variable debug info: 3 live ranges, 3 vars for method Interop+Sys:StrError(int):System.String
(V00 arg0) :From 00000000h to 0000002Ch, in rdi
(V01 loc0) :From 0000002Ch to 00000068h, in rbx
(V02 loc1) :From 00000065h to 0000006Ch, in rdi
which seems quite reasonable. So probably the error is in the translation of these ranges into DWARF format. There is no expectation that live var ranges are guaranteed to be lexically nested, so if DwarfGen is creating lexical scopes for each live var ranges then it makes sense that it causes errors.
Will try to look into why these lexical scopes are created and the correct way to represent these live ranges in DWARF.
I fixed most of the overlapping range issues in #89488. It fell into a JitInterface trap where on JitInterface we have fields named "Length" that are not actually populated as lengths in RyuJIT (#5282).
I believe the only remaining issue is with overlapping regions that are related to CORINFO_EH_CLAUSE_SAMETRY. Not sure how to represent that with DWARF.
Activity
jakobbotsch commentedon Mar 9, 2023
I'm struggling to read the output here -- what is the error saying? What are the source mappings returned from the JIT that resulted in these DWARF ranges (or is this from variable ranges?)
The JIT does not support reporting debug information in inlinees unless rich debug information is enabled (
DOTNET_RichDebugInfo=1). However, even without rich debug information things are normalized back to the root method.jakobbotsch commentedon Mar 9, 2023
Maybe ILC is emitting an incorrect
DW_AT_high_pc(which is0) for theDW_TAG_compile_unit? Is the error saying that it expected theDW_TAG_subprogramto be contained in the compile unit?agocke commentedon Mar 9, 2023
Sorry, that was a bad exmaple, maybe this one is better:
agocke commentedon Mar 9, 2023
The nesting is a different issue.
agocke commentedon Mar 9, 2023
If you use the
dwarfdumpbinary from the native AOT smoke tests, you should be able to get an actual binary.agocke commentedon Mar 9, 2023
The emit for these things is at https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/debugInfo/dwarf/dwarfGen.cpp#L564
Lexical scopes are created https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/debugInfo/dwarf/dwarfGen.cpp#L858
And an example of where variable infos are from https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/debugInfo/dwarf/dwarfGen.cpp#L697
And that all maps back to https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/cordebuginfo.h#L329
jakobbotsch commentedon Mar 9, 2023
Gotcha, thank you, I'll try to take a closer look. It sounds feasible that the JIT is emitting an incorrect variable range here.
jakobbotsch commentedon May 17, 2023
Looking at the following error:
Those lexical scopes are clearly not nested correctly in the DWARF info.
The function is
System.IO.Pipes.Interop+Sys:StrError. The variable ranges returned by the JIT are:which seems quite reasonable. So probably the error is in the translation of these ranges into DWARF format. There is no expectation that live var ranges are guaranteed to be lexically nested, so if DwarfGen is creating lexical scopes for each live var ranges then it makes sense that it causes errors.
Will try to look into why these lexical scopes are created and the correct way to represent these live ranges in DWARF.
jakobbotsch commentedon May 17, 2023
So I guess those inner scopes are created here:
https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/debugInfo/dwarf/dwarfGen.cpp#L531-L547
I would expect we shouldn't be creating these scopes at all and relying on the code that adds the variables to
.debug_locthat @agocke linked above:https://github.com/dotnet/llvm-project/blob/eb39d072da0ffac93bf087e4d8196b7133ee3a0f/llvm/tools/objwriter/debugInfo/dwarf/dwarfGen.cpp#L697
MichalStrehovsky commentedon Aug 1, 2023
I fixed most of the overlapping range issues in #89488. It fell into a JitInterface trap where on JitInterface we have fields named "Length" that are not actually populated as lengths in RyuJIT (#5282).
I believe the only remaining issue is with overlapping regions that are related to
CORINFO_EH_CLAUSE_SAMETRY. Not sure how to represent that with DWARF.agocke commentedon Aug 9, 2023
Yeah, the vast majority of the issues discussed here have been fixed. I filed a new bug for the last few issues that are left. #90209