[Lldb-commits] [PATCH] D133623: Fix DW_OP_convert to resolve the CU relative offset correctly.
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 9 16:48:17 PDT 2022
clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, aprantl.
Herald added a project: All.
clayborg requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Debugging some DWARF5 binaries was causing errors to appear when DWARFExpression::Evaluate was called:
error: GetDIE for DIE 0x31 is outside of its CU 0x123450
The issue is in the DWARF expression evaluator. Fixed with this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133623
Files:
lldb/source/Expression/DWARFExpression.cpp
Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2354,7 +2354,7 @@
"Expression stack needs at least 1 item for DW_OP_convert.");
return false;
}
- const uint64_t die_offset = opcodes.GetULEB128(&offset);
+ uint64_t die_offset = opcodes.GetULEB128(&offset);
uint64_t bit_size;
bool sign;
if (die_offset == 0) {
@@ -2374,7 +2374,9 @@
return false;
}
} else {
- // Retrieve the type DIE that the value is being converted to.
+ // Retrieve the type DIE that the value is being converted to. This
+ // offset is compile unit relative so we need to fix it up.
+ die_offset += dwarf_cu->GetOffset();
// FIXME: the constness has annoying ripple effects.
DWARFDIE die = const_cast<DWARFUnit *>(dwarf_cu)->GetDIE(die_offset);
if (!die) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133623.459231.patch
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220909/0c49593a/attachment.bin>
More information about the lldb-commits
mailing list