summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Process
diff options
context:
space:
mode:
authorDimitar Vlahovski <dvlahovski@google.com>2016-10-04 21:02:13 +0000
committerDimitar Vlahovski <dvlahovski@google.com>2016-10-04 21:02:13 +0000
commit8cabfb764d6b0390038f2d0af6f29781b4b2294b (patch)
treed5f809b2ae4a5dce6cb4e632e95b8b673547f733 /lldb/unittests/Process
parent625fba88406e3ff47ceb63b7d36d5db756ec44cf (diff)
downloadbcm5719-llvm-8cabfb764d6b0390038f2d0af6f29781b4b2294b.tar.gz
bcm5719-llvm-8cabfb764d6b0390038f2d0af6f29781b4b2294b.zip
Adding a new Minidump post-mortem debugging plugin
Summary: This plugin resembles the already existing Windows-only Minidump plugin. The WinMinidumpPlugin uses the Windows API for parsing Minidumps while this plugin is cross-platform because it includes a Minidump parser (which is already commited) It is able to produce a backtrace, to read the general puprose regiters, inspect local variables, show image list, do memory reads, etc. For now the only arch that this supports is x86 64 bit This is because I have only written a register context for that arch. Others will come in next CLs. I copied the WinMinidump tests and adapted them a little bit for them to work with the new plugin (and they pass) I will add more tests, aiming for better code coverage. There is still functionality to be added, see TODOs in code. Reviewers: labath, zturner Subscribers: beanz, mgorny, amccarth, lldb-commits, modocache Differential Revision: https://reviews.llvm.org/D25196 llvm-svn: 283259
Diffstat (limited to 'lldb/unittests/Process')
-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