<div dir="ltr">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.<br><br>Should we emit unit-relative offsets instead? <br>
<br>I've prototyped this and end up with output something like this:<div><br></div><div><div>0x00000051:   DW_TAG_base_type [24]</div><div>                DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000051] = "int")</div>
<div>                DW_AT_encoding [DW_FORM_data1]  (0x05)</div><div>                DW_AT_byte_size [DW_FORM_data1] (0x04)</div><div><br></div><div>0x00000058:   NULL</div><div>0x000001ec: Compile Unit: length = 0x0000002b version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x0000021b)</div>
<div><br></div><div>0x0000000b: DW_TAG_type_unit [25] *</div><div>              DW_AT_language [DW_FORM_data2]    (0x0004)</div><div><br></div><div>0x0000000e:   DW_TAG_namespace [9] *</div><div><br>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.<br>
<br>(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)<br>
<br>yes/no/maybe?</div></div></div>