[Lldb-commits] [lldb] [llvm] [LLDB][Minidump] Fix ProcessMinidump::GetMemoryRegions to include 64b regions when /proc/pid maps are missing. (PR #101086)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 29 17:49:52 PDT 2024


================
@@ -154,3 +155,17 @@ MinidumpFile::create(MemoryBufferRef Source) {
   return std::unique_ptr<MinidumpFile>(
       new MinidumpFile(Source, Hdr, *ExpectedStreams, std::move(StreamMap)));
 }
+
+Expected<ArrayRef<MemoryDescriptor_64>> MinidumpFile::getMemory64List() const {
+  Expected<minidump::Memory64ListHeader> MemoryList64 = getMemoryList64Header();
+  if (!MemoryList64)
+    return MemoryList64.takeError();
+
+  std::optional<ArrayRef<uint8_t>> Stream =
+      getRawStream(StreamType::Memory64List);
+  if (!Stream)
+    return createError("No such stream");
+
+  return getDataSliceAs<minidump::MemoryDescriptor_64>(
+      *Stream, sizeof(Memory64ListHeader), MemoryList64->NumberOfMemoryRanges);
+}
----------------
clayborg wrote:

The 32 bit memory list just does:
```
  Expected<ArrayRef<minidump::MemoryDescriptor>> getMemoryList() const {
    return getListStream<minidump::MemoryDescriptor>(
        minidump::StreamType::MemoryList);
  }
```
Should this be the same kind of thing:
```
  Expected<ArrayRef<minidump:: MemoryDescriptor_64>> getMemoryList64() const {
    return getListStream< minidump::MemoryDescriptor_64>(
        minidump::StreamType::MemoryList_64);
  }
```

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


More information about the lldb-commits mailing list