[LLVMdev] llvm-dwarfdump offsets

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Nov 26 10:06:50 PST 2013


> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of David Blaikie
> Sent: Monday, November 25, 2013 7:24 PM
> To: LLVM Developers Mailing List; Eric Christopher
> Subject: [LLVMdev] llvm-dwarfdump offsets
>
> llvm-dwarfdump currently outputs the offset of each DIE relative to the
> entire debug_info section. But type/DIE references within a unit are
> relative to that unit.
>
> Should we emit unit-relative offsets instead? 
>
> I've prototyped this and end up with output something like this:
>
> 0x00000051:   DW_TAG_base_type [24]
>                 DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000051] = "int")

Hopefully this second '51' is really the section-relative offset into
.debug_str and only coincidentally the same as the DIE offset.

>                 DW_AT_encoding [DW_FORM_data1]  (0x05)
>                 DW_AT_byte_size [DW_FORM_data1] (0x04)
>
> 0x00000058:   NULL
> 0x000001ec: Compile Unit: length = 0x0000002b version = 0x0004
> abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x0000021b)
>
> 0x0000000b: DW_TAG_type_unit [25] *
>               DW_AT_language [DW_FORM_data2]    (0x0004)
>
> 0x0000000e:   DW_TAG_namespace [9] *
>
> It is a bit weird using the same syntax to print the section relative
> offest for the unit header, then unit-relative offsets for the DIEs,
> but other than that this seems to me like a useful improvement.

You could use a different syntax; <0x0000000e> or something?
The unit-relative offsets are not really inherently interesting,
they're basically labels for the DIEs.  There's some minor potential
for confusion if you have multiple units and happen to have DIEs
at the same unit-relative offset in different units, but that
doesn't feel like it's worth worrying about.

>
> (I was going to use this change to help me print out the unit-relative
> offsets for types in type units to test pubnames + type units - obviously
> in the end the type units will be in their own section and unit relative
> and section relative will be synonymous again, but the change seems like
> goodness regardless)

They'd only become synonymous in .o files, they'd still be different in
a linked executable.

>
> yes/no/maybe?

Okay with me.
--paulr






More information about the llvm-dev mailing list