mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Emit debug info for bitfields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1873,7 +1873,24 @@ private:
|
||||
|
||||
AddSourceLine(MemberDie, &DT);
|
||||
|
||||
// FIXME _ Handle bitfields
|
||||
uint64_t Size = DT.getSizeInBits();
|
||||
uint64_t FieldSize = DT.getOriginalTypeSize();
|
||||
|
||||
if (Size != FieldSize) {
|
||||
// Handle bitfield.
|
||||
AddUInt(MemberDie, DW_AT_byte_size, 0, DT.getOriginalTypeSize() >> 3);
|
||||
AddUInt(MemberDie, DW_AT_bit_size, 0, DT.getSizeInBits());
|
||||
|
||||
uint64_t Offset = DT.getOffsetInBits();
|
||||
uint64_t FieldOffset = Offset;
|
||||
uint64_t AlignMask = ~(DT.getAlignInBits() - 1);
|
||||
uint64_t HiMark = (Offset + FieldSize) & AlignMask;
|
||||
FieldOffset = (HiMark - FieldSize);
|
||||
Offset -= FieldOffset;
|
||||
// Maybe we need to work from the other end.
|
||||
if (TD->isLittleEndian()) Offset = FieldSize - (Offset + Size);
|
||||
AddUInt(MemberDie, DW_AT_bit_offset, 0, Offset);
|
||||
}
|
||||
DIEBlock *Block = new DIEBlock();
|
||||
AddUInt(Block, 0, DW_FORM_data1, DW_OP_plus_uconst);
|
||||
AddUInt(Block, 0, DW_FORM_udata, DT.getOffsetInBits() >> 3);
|
||||
|
Reference in New Issue
Block a user