diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/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(dwarf_cu)->GetDIE(die_offset); if (!die) {