minidump: Use yaml instead of checked-in binaries for ThreadList tests

yaml2obj now supports the ThreadList stream.

llvm-svn: 360568
This commit is contained in:
Pavel Labath 2019-05-13 09:35:00 +00:00
parent a33e311a3b
commit 0fab8b65de
5 changed files with 41 additions and 30 deletions

View File

@ -18,7 +18,6 @@ add_lldb_unittest(LLDBMinidumpTests
set(test_inputs
fizzbuzz_no_heap.dmp
fizzbuzz_wow64.dmp
linux-i386.dmp
linux-x86_64.dmp
linux-x86_64_not_crashed.dmp
memory-list-not-padded.dmp
@ -26,8 +25,6 @@ set(test_inputs
regions-linux-map.dmp
regions-memlist.dmp
regions-memlist64.dmp
thread-list-not-padded.dmp
thread-list-padded.dmp
)
add_unittest_inputs(LLDBMinidumpTests "${test_inputs}")

View File

@ -90,7 +90,19 @@ Streams:
}
TEST_F(MinidumpParserTest, GetThreadsAndGetThreadContext) {
SetUpData("linux-x86_64.dmp");
ASSERT_THAT_ERROR(SetUpFromYaml(R"(
--- !minidump
Streams:
- Type: ThreadList
Threads:
- Thread Id: 0x00003E81
Stack:
Start of Memory Range: 0x00007FFCEB34A000
Content: C84D04BCE97F00
Context: 00000000000000
...
)"),
llvm::Succeeded());
llvm::ArrayRef<minidump::Thread> thread_list;
thread_list = parser->GetThreads();
@ -98,32 +110,10 @@ TEST_F(MinidumpParserTest, GetThreadsAndGetThreadContext) {
const minidump::Thread &thread = thread_list[0];
EXPECT_EQ(16001UL, thread.ThreadId);
EXPECT_EQ(0x3e81u, thread.ThreadId);
llvm::ArrayRef<uint8_t> context = parser->GetThreadContext(thread);
EXPECT_EQ(1232UL, context.size());
}
TEST_F(MinidumpParserTest, GetThreadListNotPadded) {
// Verify that we can load a thread list that doesn't have 4 bytes of padding
// after the thread count.
SetUpData("thread-list-not-padded.dmp");
llvm::ArrayRef<minidump::Thread> thread_list;
thread_list = parser->GetThreads();
ASSERT_EQ(2UL, thread_list.size());
EXPECT_EQ(0x11223344UL, thread_list[0].ThreadId);
EXPECT_EQ(0x55667788UL, thread_list[1].ThreadId);
}
TEST_F(MinidumpParserTest, GetThreadListPadded) {
// Verify that we can load a thread list that has 4 bytes of padding
// after the thread count as found in breakpad minidump files.
SetUpData("thread-list-padded.dmp");
auto thread_list = parser->GetThreads();
ASSERT_EQ(2UL, thread_list.size());
EXPECT_EQ(0x11223344UL, thread_list[0].ThreadId);
EXPECT_EQ(0x55667788UL, thread_list[1].ThreadId);
EXPECT_EQ(7u, context.size());
}
TEST_F(MinidumpParserTest, GetMemoryListNotPadded) {
@ -459,7 +449,19 @@ TEST_F(MinidumpParserTest, GetPidWow64) {
#define REG_VAL64(x) *(reinterpret_cast<uint64_t *>(x))
TEST_F(MinidumpParserTest, GetThreadContext_x86_32) {
SetUpData("linux-i386.dmp");
ASSERT_THAT_ERROR(SetUpFromYaml(R"(
--- !minidump
Streams:
- Type: ThreadList
Threads:
- Thread Id: 0x00026804
Stack:
Start of Memory Range: 0x00000000FF9DD000
Content: 68D39DFF
Context: 0F0001000000000000000000000000000000000000000000000000007F03FFFF0000FFFFFFFFFFFF09DC62F72300000088E36CF72B00FFFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063000000000000002B0000002B000000A88204085CD59DFF008077F7A3D49DFF01000000000000003CD59DFFA082040823000000820201002CD59DFF2B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
)"),
llvm::Succeeded());
llvm::ArrayRef<minidump::Thread> thread_list = parser->GetThreads();
const minidump::Thread &thread = thread_list[0];
llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));
@ -490,7 +492,19 @@ TEST_F(MinidumpParserTest, GetThreadContext_x86_32) {
}
TEST_F(MinidumpParserTest, GetThreadContext_x86_64) {
SetUpData("linux-x86_64.dmp");
ASSERT_THAT_ERROR(SetUpFromYaml(R"(
--- !minidump
Streams:
- Type: ThreadList
Threads:
- Thread Id: 0x00003E81
Stack:
Start of Memory Range: 0x00007FFCEB34A000
Content: C84D04BCE97F00
Context: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B0010000000000033000000000000000000000006020100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010A234EBFC7F000010A234EBFC7F00000000000000000000F09C34EBFC7F0000C0A91ABCE97F00000000000000000000A0163FBCE97F00004602000000000000921C40000000000030A434EBFC7F000000000000000000000000000000000000C61D4000000000007F0300000000000000000000000000000000000000000000801F0000FFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF25252525252525252525252525252525000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
...
)"),
llvm::Succeeded());
llvm::ArrayRef<minidump::Thread> thread_list = parser->GetThreads();
const minidump::Thread &thread = thread_list[0];
llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));