[Lldb-commits] [lldb] [lldb] Implement Process::ReadMemoryRanges (PR #163651)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 15 16:59:24 PDT 2025


================
@@ -1571,6 +1571,25 @@ class Process : public std::enable_shared_from_this<Process>,
   virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
                             Status &error);
 
+  /// Read from multiple memory ranges and write the results into buffer.
+  ///
+  /// \param[in] ranges
+  ///     A collection of ranges (base address + size) to read from.
+  ///
+  /// \param[out] buffer
+  ///     A buffer where the read memory will be written to. It must be at least
----------------
felipepiovezan wrote:

> - the buffer provided by the caller is where all the results are stored

That's correct. A single buffer is provided, and a partition of that buffer is returned.

> then the Process::ReadMemoryRanges implementation is wrong. It's checking each individual memory range size against buffer size,

I don't think this is correct (otherwise the tests would not have passed). The key line that you missed is probably this:

```
    buffer = buffer.drop_front(num_bytes_read);
```

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


More information about the lldb-commits mailing list