================
@@ -1106,6 +1124,25 @@ llvm::Expected<Value> DWARFExpression::Evaluate(
return llvm::createStringError(
"Invalid address size for DW_OP_deref_size: %d\n", size);
}
+
+ // Deref a register or implicit location and truncate the value to `size`
+ // bytes. See the corresponding comment in DW_OP_deref for more details
on
+ // why we deref these locations this way.
+ if (dwarf4_location_description_kind == Register ||
+ dwarf4_location_description_kind == Implicit) {
+ // Reset context to default values.
+ dwarf4_location_description_kind = Memory;
+ stack.back().ClearContext();
+
+ // Truncate the value on top of the stack to *size* bytes then
+ // extend to the size of an address (e.g. generic type).
+ Scalar scalar = stack.back().GetScalar();
+ scalar.TruncOrExtendTo(size * 8, /*sign=*/false);
+ scalar.TruncOrExtendTo(opcodes.GetAddressByteSize() * 8,
+ /*sign=*/false);
+ stack.back().GetScalar() = scalar;
+ break;
+ }
----------------
dmpots wrote:
Created the PR in #169587
https://github.com/llvm/llvm-project/pull/169419
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits