[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)
Miro Bucko via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 15 07:46:36 PDT 2024
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/88564
>From c588870cc8ff14806165f454d242f862ef19e89c Mon Sep 17 00:00:00 2001
From: Miro Bucko <mbucko at meta.com>
Date: Fri, 12 Apr 2024 09:55:46 -0700
Subject: [PATCH] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam
Summary:
AddMemoryList() was returning the last error status returned by ReadMemory(). So if an invalid memory region was read last, the function would return an error.
Test Plan:
./bin/llvm-lit -sv ~/src/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
Reviewers:
Subscribers:
Tasks:
Tags:
---
.../Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 50d1b563f469cf..5bf0cf1ad79d16 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -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) {
+ error.Clear();
continue;
+ }
+
// We have a good memory region with valid bytes to store.
LocationDescriptor memory_dump;
memory_dump.DataSize = static_cast<llvm::support::ulittle32_t>(bytes_read);
More information about the lldb-commits
mailing list