diff options
author | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
commit | c432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch) | |
tree | 4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump | |
parent | a8a3bd210086b50242903ed95048fe5e53897878 (diff) | |
download | bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip |
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code
structured into a bona-fide Python package. This has a number
of benefits, but most notably the ability to more easily share
Python code between different but related pieces of LLDB's Python
infrastructure (for example, `scripts` can now share code with
`test`).
llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump')
3 files changed, 72 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py new file mode 100644 index 00000000000..46dbb1d59df --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -0,0 +1,41 @@ +""" +Test basics of mini dump debugging. +""" + +from __future__ import print_function + +import use_lldb_suite + +import lldb +from lldbtest import * +import lldbutil + +@skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts +class MiniDumpTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @no_debug_info_test + def test_process_info_in_mini_dump(self): + """Test that lldb can read the process information from the minidump.""" + self.assertTrue(self.process, PROCESS_IS_VALID) + self.assertEqual(self.process.GetNumThreads(), 1) + self.assertEqual(self.process.GetProcessID(), 4440) + + @no_debug_info_test + def test_thread_info_in_mini_dump(self): + """Test that lldb can read the thread information from the minidump.""" + # This process crashed due to an access violation (0xc0000005) in its one and only thread. + self.assertEqual(self.process.GetNumThreads(), 1) + thread = self.process.GetThreadAtIndex(0) + self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException) + stop_description = thread.GetStopDescription(256); + self.assertTrue("0xc0000005" in stop_description); + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # target create -c fizzbuzz_no_heap.dmp + self.dbg.CreateTarget("") + self.target = self.dbg.GetSelectedTarget() + self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp new file mode 100644 index 00000000000..eb6476bfd9a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp @@ -0,0 +1,31 @@ +// A sample program for getting minidumps on Windows.
+
+#include <iostream>
+
+bool
+fizz(int x)
+{
+ return x % 3 == 0;
+}
+
+bool
+buzz(int x)
+{
+ return x % 5 == 0;
+}
+
+int
+main()
+{
+ int *buggy = 0;
+
+ for (int i = 1; i <= 100; ++i)
+ {
+ if (fizz(i)) std::cout << "fizz";
+ if (buzz(i)) std::cout << "buzz";
+ if (!fizz(i) && !buzz(i)) std::cout << i;
+ std::cout << '\n';
+ }
+
+ return *buggy;
+}
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp Binary files differnew file mode 100644 index 00000000000..19008c91fc3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp |