[llvm] [TOOLS][DWARFDUMP][DWARF] Print full DIE offset for a CU or local TU (PR #121877)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 7 14:43:02 PST 2025
ayermolo wrote:
> Adding the DIE offset to the CU offset for foreign CUs would be incorrect - the DIE offset is in the split full unit, but the CU offset is to the skeleton unit.
>
> Could we render the CU offset when we dump the DW_IDX_compile/type_unit (& then users could add the two offsets together more easily, since they'd be right next to each other?)? (& for foreign units, we could dump the skeleton CU offset and the TU hash)
>
> Seems awkward for some of the hashes to be absolute, and some not/hard to tell at the context - I guess maybe the most general might look like:
>
> Local CU/TU, something like (CU offset, plus DIE offset, then total): `DW_IDX_offset: 0x00000001 + 0x00000002 = 0x00000003` Then for foreign CU/TU, maybe the best thing is DWO ID relative? `DW_IDX_offset: 0x1234abcd -> 0x00000002` or something like that?
Ah yeah, Skeleton CU is the problem. The issue is we know CU offset, but to figure out if it's Skeleton or regular we need to parse the header (In DWARF5 DWO ID is there now). We can use DWARFContext::getUnitForOffset. Although from DebugNames we don't have access to the DWARFContext it seems. We can pass it in (make it as an optional parameter to dump?), and then parse. WDYT? From implementation perspective kind of annoying, but so as doing manual calculations all the time when looking and the output.
https://github.com/llvm/llvm-project/pull/121877
More information about the llvm-commits
mailing list