[Dwarf-Discuss] DWARF piece questions
ccoutant at gmail.com
Fri Jan 27 17:32:25 PST 2017
>> I think the original intent of this wording was to describe the bit
>> offset of a field within a structure, given the byte address of the
>> beginning of the structure. Said bit offset would be the total number
>> of bits occupied by preceding fields plus internal padding, as
>> demonstrated in the big- and little-endian examples in D.2.8. We
>> should never have implied that this bit numbering was meant to match
>> the bit numbering convention used in the ABI specification.
> Unfortunately, that's exactly what DWARF says.
But it's not what we meant, and we should fix it.
>> This is not the only place we use this bit numbering convention -- we
>> also use it for the DW_AT_data_bit_offset attribute, and it's defined
>> in Section 5.7, with a reference to the examples in D.2.8.
> Also, not what we want.
Why is this not what we want? There's really no better way to define a
field's position within a structure.
>> I think it's also unfortunate that we allowed the offset field for
>> DW_OP_bit_piece to apply to register values. That's a very different
>> use for the value, and just adds to the confusion.
> It's the same use when a register contains multiple fields of a struct.
How about if we define this in terms of a left shift instead of a bit
offset relative to the least-significant bit?
"If the location is a register, the value is shifted left by offset
bits within the register."
More information about the Dwarf-Discuss