Debug info: Bugfix for r201190: DW_OP_piece takes bytes, not bits.

rdar://problem/16015314

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201253 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl 2014-02-12 19:34:44 +00:00
parent 386fedd32e
commit 4c1ea6b115
4 changed files with 7 additions and 5 deletions

View File

@ -931,8 +931,9 @@ void AsmPrinter::EmitDwarfRegOp(const MachineLocation &MLoc,
} else { } else {
OutStreamer.AddComment("DW_OP_piece"); OutStreamer.AddComment("DW_OP_piece");
EmitInt8(dwarf::DW_OP_piece); EmitInt8(dwarf::DW_OP_piece);
OutStreamer.AddComment(Twine(Size)); unsigned ByteSize = Size / 8; // Assuming 8 bits per byte.
EmitULEB128(Size); OutStreamer.AddComment(Twine(ByteSize));
EmitULEB128(ByteSize);
} }
} }
} }

View File

@ -470,8 +470,9 @@ void DwarfUnit::addRegisterOp(DIEBlock *TheDie, unsigned Reg) {
addUInt(TheDie, dwarf::DW_FORM_data1, Size); addUInt(TheDie, dwarf::DW_FORM_data1, Size);
addUInt(TheDie, dwarf::DW_FORM_data1, Offset); addUInt(TheDie, dwarf::DW_FORM_data1, Offset);
} else { } else {
unsigned ByteSize = Size / 8; // Assuming 8 bits per byte.
addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_piece); addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_piece);
addUInt(TheDie, dwarf::DW_FORM_data1, Size); addUInt(TheDie, dwarf::DW_FORM_data1, ByteSize);
} }
} }
} }

View File

@ -5,7 +5,7 @@
; CHECK: .byte 80 # DW_OP_reg0 ; CHECK: .byte 80 # DW_OP_reg0
; CHECK: .byte 147 # DW_OP_piece ; CHECK: .byte 147 # DW_OP_piece
; CHECK: .byte 16 # 16 ; CHECK: .byte 2 # 2
define i16 @f(i16 signext %zzz) nounwind { define i16 @f(i16 signext %zzz) nounwind {
entry: entry:

View File

@ -7,7 +7,7 @@
; rdar://problem/16015314 ; rdar://problem/16015314
; ;
; CHECK: DW_AT_name [DW_FORM_strp]{{.*}} "a" ; CHECK: DW_AT_name [DW_FORM_strp]{{.*}} "a"
; CHECK: DW_AT_location [DW_FORM_block1] (<0x03> 54 93 20 ) ; CHECK: DW_AT_location [DW_FORM_block1] (<0x03> 54 93 04 )
; ;
; struct bar { ; struct bar {
; int a; ; int a;