[Lldb-commits] [lldb] [llvm] [Obj2Yaml] Add support for minidump generation with 64b memory ranges. (PR #101272)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 30 21:32:22 PDT 2024
================
@@ -336,3 +336,51 @@ 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
+ Data Size: 8
+ Content: '68656c6c6f'
+ - Start of Memory Range: 0x7FFFFFFF0818283
+ Data Size: 8
+ Content: '776f726c64'
+ )");
+
+ ASSERT_THAT_EXPECTED(ExpectedFile, Succeeded());
+ object::MinidumpFile &File = **ExpectedFile;
+
+ ASSERT_EQ(1u, File.streams().size());
+
+ Expected<ArrayRef<minidump::MemoryDescriptor_64>> ExpectedMemoryList =
+ File.getMemory64List();
+
+ ASSERT_THAT_EXPECTED(ExpectedMemoryList, Succeeded());
+
+ ArrayRef<minidump::MemoryDescriptor_64> MemoryList = *ExpectedMemoryList;
+ ASSERT_EQ(2u, MemoryList.size());
+
+ const minidump::MemoryDescriptor_64 &DescOne = MemoryList[0];
+ ASSERT_EQ(0x7FFFFFCF0818283u, DescOne.StartOfMemoryRange);
+ ASSERT_EQ(8u, DescOne.DataSize);
+
+ const minidump::MemoryDescriptor_64 &DescTwo = MemoryList[1];
+ ASSERT_EQ(0x7FFFFFFF0818283u, DescTwo.StartOfMemoryRange);
+ ASSERT_EQ(8u, DescTwo.DataSize);
+
+ const std::optional<ArrayRef<uint8_t>> ExpectedContent =
+ File.getRawStream(StreamType::Memory64List);
+ ASSERT_TRUE(ExpectedContent);
+ const ArrayRef<uint8_t> Content = *ExpectedContent;
+ const size_t offset =
+ sizeof(Memory64ListHeader) + (sizeof(MemoryDescriptor_64) * 2);
+ const uint64_t *Array =
+ reinterpret_cast<const uint64_t *>(Content.slice(offset, 16).data(), 16);
+ ASSERT_EQ(0x7000000000002Au, Array[0]);
+ ASSERT_EQ(0x7000A00000000Au, Array[1]);
----------------
clayborg wrote:
Line 382 asserts for me:
```
Assertion failed: (N+M <= size() && "Invalid specifier"), function slice, file ArrayRef.h, line 196.
(lldb) v --raw Content
(llvm::ArrayRef<unsigned char>) Content = {
Data = 0x0000000138e0625c
Length = 48
}
offset = 48
```
https://github.com/llvm/llvm-project/pull/101272
More information about the lldb-commits
mailing list