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

Jacob Lalonde via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 09:04:17 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>(
----------------
Jlalond wrote:

I was a bit flippant, but I think the only confusion for me is that the pointers are always being converted to an ArrayRef, 

`getDataSliceAsArrayOf<>` could work but is particularly verbose

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


More information about the llvm-commits mailing list