================
@@ -657,8 +657,11 @@ MinidumpFileBuilder::AddMemoryList(const lldb::ProcessSP 
&process_sp,
     auto data_up = std::make_unique<DataBufferHeap>(size, 0);
     const size_t bytes_read =
         process_sp->ReadMemory(addr, data_up->GetBytes(), size, error);
-    if (bytes_read == 0)
+    if (error.Fail() || bytes_read == 0) {
----------------
clayborg wrote:

So a few things here:
1 - We should fix `Process::CalculateCoreFileSaveRanges(...)` to not include 
memory ranges that have no read access. The fix will need to go into this 
function in Process.cpp:
```
static void AddRegion(const MemoryRegionInfo &region, bool try_dirty_pages, 
Process::CoreFileMemoryRanges &ranges) {
  // Don't add empty ranges or ranges with no permissions.
  if (region.GetRange().GetByteSize() == 0 || region.GetLLDBPermissions() == 0)
    return;
  if (try_dirty_pages && AddDirtyPages(region, ranges))
    return;
  ranges.push_back(CreateCoreFileMemoryRange(region));
}
```
Above is the current version of this function, we just need to fix the first if 
statement to not just check if there are any permissions, but to check if the 
section is readable:
```
if (region.GetRange().GetByteSize() == 0 || ((region.GetLLDBPermissions() & 
lldb::ePermissionsReadable) == 0))
```


https://github.com/llvm/llvm-project/pull/88564
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to