[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 15 11:58:43 PDT 2024


================
@@ -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:

This function should report any errors that are found when reading memory, but it should also save _any_ bytes that are read if `bytes_read` is not zero. So we might ask to read an entire region, but only get part of it for some reason, in that case we might get an error saying "error: not all bytes read from section", but if `bytes_read` is greater than zero, we need to save those bytes and not skip them.

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


More information about the lldb-commits mailing list