================
@@ -892,6 +892,25 @@ static llvm::Error 
Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
     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);
----------------
clayborg wrote:

Lets wait on `DW_OP_LLVM_offset` for now until we need it.

https://github.com/llvm/llvm-project/pull/169419
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to