[Dwarf-Discuss] Split Dwarf vs. CU DW_AT_ranges / DW_AT_low_pc placement

Cary Coutant ccoutant@gmail.com
Wed Mar 10 22:36:33 GMT 2021


On Wed, Mar 10, 2021 at 1:27 PM David Blaikie <dblaikie at gmail.com> wrote:
>
> On Wed, Mar 10, 2021 at 1:16 PM Cary Coutant <ccoutant at gmail.com> wrote:
>>
>> > But what about the DW_AT_ranges on the skeleton CU when using split DWARF?
>> >
>> > Are you suggesting that both LLVM and GCC's emission is incorrect - and that it's not possible to use rnglistx in the skeleton CU (instead you must use sec_offset for DW_AT_ranges on the skeleton CU)? (& that there's no way to refer to range lists in the .o (debug_rnglists) from the .dwo - all ranges in the split full unit must be in debug_rnglists.dwo?)
>>
>> If you've moved range lists over to the dwo, having DW_AT_ranges in
>> the skeleton CU would be pointless ? the consumer would still have to
>> go find the dwo to get the ranges.
>>
>> For the case you suggested where it would be useful to keep the range
>> list for the CU in the .o file, I think .debug_aranges is what you're
>> looking for.
>
>
> aranges has been off by default in LLVM for a while - it adds a lot of overhead (doesn't have all the nice rnglist encodings for instance - nor can it use debug_addr, and if it did it'd still be duplicate with the CU ranges wherever they were).
>
> DWARFv5 says:
>
> "A skeleton compilation unit may have additional attributes, which are the same as for conventional compilation unit entries except as noted, from among the following:
>   2. Either a DW_AT_low_pc and DW_AT_high_pc pair of attributes or a DW_AT_ranges attribute."
>
> and
>
> "The following attributes are not part of a split full compilation unit entry but instead are inherited (if present) from the corresponding skeleton compilation unit: DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, ..."
>
> Even before the rnglist move, this still disallowed using DW_AT_low/high_pc with addrx encodings from the split full unit, instead requiring them to be in the skeleton unit. I think this is the right call (& guess it was motivated by this use case) to make for cheap unit lookup.

Hmm. I'm thinking that wording is from before the rnglist move, and
did not get updated properly. Or maybe it was intentional, but not
thought all the way through. Forcing DW_AT_ranges to be in the
skeleton CU when the actual range lists are in the dwo is silly.
DW_AT_low_pc/_high_pc in the skeleton makes sense, though.

But you've got me thinking.... Perhaps we should have *both*
.debug_rnglists *and* .debug_rnglists.dwo. The former could contain
only the range list needed for the DW_AT_ranges attribute in the
skeleton CU, while the latter would contain the range lists for any
DW_AT_ranges attributes in the dwo sections.

If you (LLVM) are already choosing not to use .debug_aranges for quick
address lookup, does that suggest that per-CU ranges are sufficient?
Can we get rid of .debug_aranges?

-cary



More information about the Dwarf-discuss mailing list