[Dwarf-discuss] Enhancement: Dynamic DW_AT_data_bit_offset

Tom Tromey tromey@adacore.com
Tue Apr 29 17:23:57 GMT 2025


>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> Just to make sure I understand, can you clarify how
Simon> DW_AT_data_member_location and DW_AT_bit_offset are used in this
Simon> case?  In particular, which one is constant and which one is an
Simon> evaluated expression?

Dynamic DW_AT_data_member_location, static DW_AT_bit_offset:


 <5><117a>: Abbrev Number: 17 (DW_TAG_member)
    <117b>   DW_AT_name        : (indirect string, offset: 0x1959): another_field
...
    <1188>   DW_AT_bit_offset  : 6
    <1189>   DW_AT_data_member_location: 6 byte block: 99 3d 1 0 0 22 	(DW_OP_call4: <0x1193>; DW_OP_plus)
...
 <3><1193>: Abbrev Number: 2 (DW_TAG_dwarf_procedure)
    <1194>   DW_AT_location    : 15 byte block: 97 94 1 37 1a 32 1e 23 7 38 1b 31 1c 23 3 	(DW_OP_push_object_address; DW_OP_deref_size: 1; DW_OP_lit7; DW_OP_and; DW_OP_lit2; DW_OP_mul; DW_OP_plus_uconst: 7; DW_OP_lit8; DW_OP_div; DW_OP_lit1; DW_OP_minus; DW_OP_plus_uconst: 3)


This comes from the description of this gdb patch, which includes a test
case.  (However, you'd need a patched GCC to get this output.)

    https://sourceware.org/pipermail/gdb-patches/2025-April/217289.html

Tom


More information about the Dwarf-discuss mailing list