[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 16:46:53 PDT 2025


================
@@ -969,6 +969,66 @@ Status MinidumpFileBuilder::DumpDirectories() const {
   return error;
 }
 
+Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
+    lldb_private::DataBufferHeap &data_buffer,
+    const lldb_private::CoreFileMemoryRange &range, uint64_t &bytes_read) {
+
+  const lldb::addr_t addr = range.range.start();
+  const lldb::addr_t size = range.range.size();
+  Log *log = GetLog(LLDBLog::Object);
+  Status addDataError;
+  Process::ReadMemoryChunkCallback callback =
+      [&](Status &error, lldb::addr_t current_addr, const void *buf,
+          uint64_t bytes_read_for_chunk) -> lldb_private::IterationAction {
+    if (error.Fail() || bytes_read_for_chunk == 0) {
+      LLDB_LOGF(log,
+                "Failed to read memory region at: %" PRIx64
+                ". Bytes read: %zu, error: %s",
+                current_addr, bytes_read_for_chunk, error.AsCString());
----------------
clayborg wrote:

Don't use `size_t`, use `lldb::offset_t`:
```
". Bytes read: %" PRIu64 ", error: %s",
                current_addr, bytes_read_for_chunk, error.AsCString());
```

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


More information about the lldb-commits mailing list