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

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 7 16:43:56 PST 2025


================
@@ -969,12 +969,83 @@ Status MinidumpFileBuilder::DumpDirectories() const {
   return error;
 }
 
-static uint64_t
-GetLargestRangeSize(const std::vector<CoreFileMemoryRange> &ranges) {
-  uint64_t max_size = 0;
-  for (const auto &core_range : ranges)
-    max_size = std::max(max_size, core_range.range.size());
-  return max_size;
+Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
+    const lldb_private::CoreFileMemoryRange &range, uint64_t *bytes_read) {
+  Log *log = GetLog(LLDBLog::Object);
+  lldb::addr_t addr = range.range.start();
+  lldb::addr_t size = range.range.size();
+  // First we set the byte tally to 0, so if we do exit gracefully
+  // the caller doesn't think the random garbage on the stack is a
+  // success.
+  if (bytes_read)
----------------
jeffreytan81 wrote:

I would agree with @mbucko here to ensure caller pass a valid `bytes_read`. 
Then you can get rid of `total_bytes_read` variable with `*bytes_read`

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


More information about the lldb-commits mailing list