<div dir="ltr"><div>I'm trying to extract information about bitfields in a structure using DWARF info.</div><div><br></div><div>The info generated by LLVM seems to be incorrect and not following the DWARF standard.</div><div><br></div><div>If this isn't the right mailing list, please let me know.</div><div><br></div><div>If you look at DwarfUnit.cpp in the current LLVM src, it is using DIDerivedType.getOffsetInBits() for the value of DW_AT_data_bit_offset.</div><div><br></div><div>The DWARF standard states that the bit offset: "is the offset in bits from the beginning of the containing storage to the beginning of the value", meaning the field the bitfield is packed in, not the structure holding the field.</div><div><br></div><div>As a result of this, the values that LLVM emit are completely out of line with the values that I'm seeing come from gcc.</div><div><br></div><div>(Of course, you can't use a naive example where the bitfields are at the beginning of the struct to test this, they need to occur later in the struct).</div><div><br></div></div>