[Lldb-commits] [lldb] [LLDB][Minidump]Update MinidumpFileBuilder to read and write in chunks (PR #129307)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 7 10:57:46 PDT 2025


================
@@ -1589,6 +1589,48 @@ class Process : public std::enable_shared_from_this<Process>,
   size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size,
                                 Status &error);
 
+  // Callback definition for read Memory in chunks
+  //
+  // Status, the status returned from ReadMemoryFromInferior
+  // DataBufferHeap, buffer with bytes potentially written to it
+  // addr_t, the current_addr, start + bytes read so far.
+  // uint64_t bytes_to_read, the expected bytes read, this
+  // is important if it's a partial read
+  // uint64_t bytes_read_for_chunk, the actual count of bytes read for this
+  // chunk
+  typedef std::function<IterationAction(lldb_private::Status &,
+                                        lldb_private::DataBufferHeap &,
+                                        lldb::addr_t, uint64_t, uint64_t)>
----------------
clayborg wrote:

We should just pass the bytes without requiring someone to use a DataBufferHeap. I suggest a change below that passes the chunk size into the `Process::ReadMemoryInChunks(...)` call, so we don't need the `bytes_to_read` argument. So this callback can be:
```
typedef std::function<IterationAction(
  Status &error, /// The error for the current memory chunk that was read
  lldb::addr_t bytes_addr, /// The address corresponding to the bytes supplied
  const uint8_t *bytes, /// The bytes for the current chunk
  uint64_t bytes_size, /// The number of bytes in the bytes argument
)>
```


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


More information about the lldb-commits mailing list