mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[DebugInfo] Handle generic type DW_OP_convert ops in dsymutil
Summary: This is a preparatory change for allowing LLVM to emit DW_OP_convert operations converting to the generic type. If DW_OP_convert's operand is 0, it converts the top of the stack to the generic type, as specified by DWARFv5 section 2.5.1.6: "[...] takes one operand, which is an unsigned LEB128 integer that represents the offset of a debugging information entry in the current compilation unit, or value 0 which represents the generic type." This adds support for such operations to dsymutil. Reviewers: aprantl, markus, friss, JDevlieghere Reviewed By: aprantl, JDevlieghere Subscribers: hiraditya, llvm-commits Tags: #debug-info, #llvm Differential Revision: https://reviews.llvm.org/D76142
This commit is contained in:
parent
548bf9dd60
commit
fb2db17ed1
@ -923,15 +923,20 @@ void DWARFLinker::DIECloner::cloneExpression(
|
||||
OutputBuffer.push_back(Op.getRawOperand(0));
|
||||
RefOffset = Op.getRawOperand(1);
|
||||
}
|
||||
auto RefDie = Unit.getOrigUnit().getDIEForOffset(RefOffset);
|
||||
uint32_t RefIdx = Unit.getOrigUnit().getDIEIndex(RefDie);
|
||||
CompileUnit::DIEInfo &Info = Unit.getInfo(RefIdx);
|
||||
uint32_t Offset = 0;
|
||||
if (DIE *Clone = Info.Clone)
|
||||
Offset = Clone->getOffset();
|
||||
else
|
||||
Linker.reportWarning("base type ref doesn't point to DW_TAG_base_type.",
|
||||
File);
|
||||
// Look up the base type. For DW_OP_convert, the operand may be 0 to
|
||||
// instead indicate the generic type. The same holds for
|
||||
// DW_OP_reinterpret, which is currently not supported.
|
||||
if (RefOffset > 0 || Op.getCode() != dwarf::DW_OP_convert) {
|
||||
auto RefDie = Unit.getOrigUnit().getDIEForOffset(RefOffset);
|
||||
uint32_t RefIdx = Unit.getOrigUnit().getDIEIndex(RefDie);
|
||||
CompileUnit::DIEInfo &Info = Unit.getInfo(RefIdx);
|
||||
if (DIE *Clone = Info.Clone)
|
||||
Offset = Clone->getOffset();
|
||||
else
|
||||
Linker.reportWarning(
|
||||
"base type ref doesn't point to DW_TAG_base_type.", File);
|
||||
}
|
||||
uint8_t ULEB[16];
|
||||
unsigned RealSize = encodeULEB128(Offset, ULEB, ULEBsize);
|
||||
if (RealSize > ULEBsize) {
|
||||
|
@ -9,6 +9,7 @@ entry:
|
||||
call void @llvm.dbg.value(metadata i8 42, metadata !17, metadata !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)), !dbg !12
|
||||
call void @llvm.dbg.value(metadata i8 %x, metadata !11, metadata !DIExpression()), !dbg !12
|
||||
call void @llvm.dbg.value(metadata i8 %x, metadata !13, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)), !dbg !15
|
||||
call void @llvm.dbg.value(metadata i8 51, metadata !18, metadata !DIExpression(DW_OP_LLVM_convert_generic, DW_OP_stack_value)), !dbg !15
|
||||
ret i8 %x, !dbg !16
|
||||
}
|
||||
|
||||
@ -43,3 +44,4 @@ attributes #1 = { nounwind readnone speculatable }
|
||||
!15 = !DILocation(line: 3, column: 14, scope: !7)
|
||||
!16 = !DILocation(line: 4, column: 3, scope: !7)
|
||||
!17 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !14)
|
||||
!18 = !DILocalVariable(name: "d", scope: !7, file: !1, line: 3, type: !14)
|
||||
|
Binary file not shown.
@ -26,6 +26,10 @@ CHECK-NEXT: [0x0000000000001000, 0x0000000000001002): DW_OP_breg5 RDI+0, DW
|
||||
CHECK-NEXT: [0x0000000000001002, 0x0000000000001003): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_convert (0x0000002a) "DW_ATE_signed_8", DW_OP_convert (0x00000031) "DW_ATE_signed_32", DW_OP_stack_value)
|
||||
CHECK-NEXT: DW_AT_name ("y")
|
||||
|
||||
CHECK: DW_TAG_variable
|
||||
CHECK-NEXT: DW_AT_location (DW_OP_constu 0x33, DW_OP_convert 0x0, DW_OP_stack_value)
|
||||
CHECK-NEXT: DW_AT_name ("d")
|
||||
|
||||
CHECK: DW_TAG_variable
|
||||
CHECK-NEXT: DW_AT_location (DW_OP_constu 0x2a, DW_OP_convert (0x00000031) "DW_ATE_signed_32", DW_OP_stack_value)
|
||||
CHECK-NEXT: DW_AT_name ("c")
|
||||
|
Loading…
Reference in New Issue
Block a user