[llvm] 97dbab8 - llvm-dwarfdump: fix the counting when printing DW_OP_entry_value
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 11:17:24 PST 2021
Author: Adrian Prantl
Date: 2021-02-11T11:17:04-08:00
New Revision: 97dbab879700fa51abe5f090ea31bfbed3483701
URL: https://github.com/llvm/llvm-project/commit/97dbab879700fa51abe5f090ea31bfbed3483701
DIFF: https://github.com/llvm/llvm-project/commit/97dbab879700fa51abe5f090ea31bfbed3483701.diff
LOG: 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
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
llvm/test/tools/llvm-dwarfdump/X86/debug_loc_OP_entry_value.s
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 4293e52ea762..d5015f00f1cf 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -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 << ")";
}
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_loc_OP_entry_value.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_loc_OP_entry_value.s
index a5e246240ed2..889fe501884f 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_loc_OP_entry_value.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_loc_OP_entry_value.s
@@ -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", at 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
More information about the llvm-commits
mailing list