summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/unittests/Process/minidump/MinidumpParserTest.cpp')
-rw-r--r--lldb/unittests/Process/minidump/MinidumpParserTest.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
index 7597fab36c2..cbb8f7f6098 100644
--- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -60,7 +60,7 @@ public:
std::unique_ptr<MinidumpParser> parser;
};
-TEST_F(MinidumpParserTest, GetThreads) {
+TEST_F(MinidumpParserTest, GetThreadsAndGetThreadContext) {
SetUpData("linux-x86_64.dmp");
llvm::ArrayRef<MinidumpThread> thread_list;
@@ -68,7 +68,10 @@ TEST_F(MinidumpParserTest, GetThreads) {
ASSERT_EQ(1UL, thread_list.size());
const MinidumpThread thread = thread_list[0];
- ASSERT_EQ(16001UL, thread.thread_id);
+ EXPECT_EQ(16001UL, thread.thread_id);
+
+ llvm::ArrayRef<uint8_t> context = parser->GetThreadContext(thread);
+ EXPECT_EQ(1232, context.size());
}
TEST_F(MinidumpParserTest, GetThreadsTruncatedFile) {
@@ -139,6 +142,24 @@ TEST_F(MinidumpParserTest, GetExceptionStream) {
ASSERT_EQ(11UL, exception_stream->exception_record.exception_code);
}
+TEST_F(MinidumpParserTest, GetMemoryRange) {
+ SetUpData("linux-x86_64.dmp");
+ // There are two memory ranges in the file (size is in bytes, decimal):
+ // 1) 0x7ffceb34a000 12288
+ // 2) 0x401d46 256
+ EXPECT_TRUE(parser->FindMemoryRange(0x7ffceb34a000).hasValue());
+ EXPECT_TRUE(parser->FindMemoryRange(0x7ffceb34a000 + 12288 / 2).hasValue());
+ EXPECT_TRUE(parser->FindMemoryRange(0x7ffceb34a000 + 12288 - 1).hasValue());
+ EXPECT_FALSE(parser->FindMemoryRange(0x7ffceb34a000 + 12288).hasValue());
+
+ EXPECT_TRUE(parser->FindMemoryRange(0x401d46).hasValue());
+ EXPECT_TRUE(parser->FindMemoryRange(0x401d46 + 256 / 2).hasValue());
+ EXPECT_TRUE(parser->FindMemoryRange(0x401d46 + 256 - 1).hasValue());
+ EXPECT_FALSE(parser->FindMemoryRange(0x401d46 + 256).hasValue());
+
+ EXPECT_FALSE(parser->FindMemoryRange(0x2a).hasValue());
+}
+
// Windows Minidump tests
// fizzbuzz_no_heap.dmp is copied from the WinMiniDump tests
TEST_F(MinidumpParserTest, GetArchitectureWindows) {
@@ -172,7 +193,6 @@ TEST_F(MinidumpParserTest, GetPidWindows) {
}
// Register stuff
-// TODO probably split register stuff tests into different file?
#define REG_VAL(x) *(reinterpret_cast<uint64_t *>(x))
TEST_F(MinidumpParserTest, ConvertRegisterContext) {
OpenPOWER on IntegriCloud