[Lldb-commits] [lldb] [lldb] Support reading DW_OP_piece from file address (PR #94026)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri May 31 12:54:34 PDT 2024


================
@@ -2153,26 +2152,41 @@ bool DWARFExpression::Evaluate(
             }
             break;
 
-          case Value::ValueType::FileAddress:
-          case Value::ValueType::HostAddress:
-            if (error_ptr) {
-              lldb::addr_t addr = curr_piece_source_value.GetScalar().ULongLong(
-                  LLDB_INVALID_ADDRESS);
+          case Value::ValueType::FileAddress: {
+            if (target) {
+              if (curr_piece.ResizeData(piece_byte_size) == piece_byte_size) {
+                if (target->ReadMemory(addr, curr_piece.GetBuffer().GetBytes(),
+                                       piece_byte_size, error,
+                                       /*force_live_memory=*/false) !=
+                    piece_byte_size) {
+                  if (error_ptr)
+                    error_ptr->SetErrorStringWithFormat(
+                        "failed to read memory DW_OP_piece(%" PRIu64
+                        ") from file address 0x%" PRIx64,
+                        piece_byte_size, addr);
+                  return false;
+                }
+              } else {
+                if (error_ptr)
----------------
JDevlieghere wrote:

Yeah, absolutely. 

https://github.com/llvm/llvm-project/pull/94026


More information about the lldb-commits mailing list