[Lldb-commits] [lldb] [llvm] [Obj2Yaml] Add support for minidump generation with 64b memory ranges. (PR #101272)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 8 01:08:35 PDT 2024


================
@@ -336,3 +336,88 @@ TEST(MinidumpYAML, ExceptionStream_ExtraParameter) {
                                0xab, 0xad, 0xca, 0xfe}),
             *ExpectedContext);
 }
+
+TEST(MinidumpYAML, MemoryRegion_64bit) {
+  SmallString<0> Storage;
+  auto ExpectedFile = toBinary(Storage, R"(
+--- !minidump
+Streams:
+  - Type:            Memory64List
+    Memory Ranges:
+      - Start of Memory Range: 0x7FFFFFCF0818283
+        Content:               '68656c6c6f'
+      - Start of Memory Range: 0x7FFFFFFF0818283
+        Content:               '776f726c64'
+        )");
+
+  ASSERT_THAT_EXPECTED(ExpectedFile, Succeeded());
+  object::MinidumpFile &File = **ExpectedFile;
+
+  ASSERT_THAT(File.streams().size(), 1u);
+
+  Error Err = Error::success();
+  // Explicit Err check
+  ASSERT_FALSE(Err);
+  Expected<iterator_range<object::MinidumpFile::FallibleMemory64Iterator>>
+      ExpectedMemoryList = File.getMemory64List(Err);
+
+  ASSERT_THAT_EXPECTED(ExpectedMemoryList, Succeeded());
+
+  iterator_range<object::MinidumpFile::FallibleMemory64Iterator> MemoryList =
+      *ExpectedMemoryList;
----------------
labath wrote:

```suggestion
  iterator_range<object::MinidumpFile::FallibleMemory64Iterator> = File.getMemory64List(Err);

  ASSERT_THAT_ERROR(Err, Succeeded());
```

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


More information about the lldb-commits mailing list