1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

llvm-dwarfdump: fix the counting when printing DW_OP_entry_value

The block size is in bytes, and not number of operands.

Differential Revision: https://reviews.llvm.org/D96472
This commit is contained in:
Adrian Prantl 2021-02-11 11:06:44 -08:00
parent 7744abeec1
commit b8b6f85b4f
2 changed files with 7 additions and 4 deletions

View File

@ -325,6 +325,7 @@ void DWARFExpression::print(raw_ostream &OS, DIDumpOptions DumpOpts,
const MCRegisterInfo *RegInfo, DWARFUnit *U,
bool IsEH) const {
uint32_t EntryValExprSize = 0;
uint64_t EntryValStartOffset = 0;
for (auto &Op : *this) {
if (!Op.print(OS, DumpOpts, this, RegInfo, U, IsEH)) {
uint64_t FailOffset = Op.getEndOffset();
@ -337,11 +338,12 @@ void DWARFExpression::print(raw_ostream &OS, DIDumpOptions DumpOpts,
Op.getCode() == DW_OP_GNU_entry_value) {
OS << "(";
EntryValExprSize = Op.getRawOperand(0);
EntryValStartOffset = Op.getEndOffset();
continue;
}
if (EntryValExprSize) {
EntryValExprSize--;
EntryValExprSize -= Op.getEndOffset() - EntryValStartOffset;
if (EntryValExprSize == 0)
OS << ")";
}

View File

@ -3,7 +3,7 @@
# CHECK: DW_TAG_variable
# CHECK-NEXT: DW_AT_name ("a")
# CHECK-NEXT: DW_AT_location
# CHECK-NEXT: DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
# CHECK-NEXT: DW_OP_entry_value(DW_OP_breg5 RDI+0), DW_OP_stack_value)
.section .debug_str,"MS",@progbits,1
.Linfo_producer:
@ -18,8 +18,9 @@
.short .Lloc0_end-.Lloc0_start # Loc expr size
.Lloc0_start:
.byte 163 # DW_OP_entry_value
.byte 1 # 1
.byte 85 # super-register DW_OP_reg5
.byte 2 # 2
.byte 117 # DW_OP_breg5
.byte 0 # +0
.byte 159 # DW_OP_stack_value
.Lloc0_end:
.quad 0