Author: amccarth Date: Wed Sep 16 13:17:11 2015 New Revision: 247829 URL: http://llvm.org/viewvc/llvm-project?rev=247829&view=rev Log: Add first tests for mini-dump debugging. Differential Revision: http://reviews.llvm.org/D12888
Added: lldb/trunk/test/functionalities/postmortem/ lldb/trunk/test/functionalities/postmortem/minidump/ lldb/trunk/test/functionalities/postmortem/minidump/TestMiniDump.py lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz.cpp lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp Modified: lldb/trunk/test/lldbtest.py Added: lldb/trunk/test/functionalities/postmortem/minidump/TestMiniDump.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/postmortem/minidump/TestMiniDump.py?rev=247829&view=auto ============================================================================== --- lldb/trunk/test/functionalities/postmortem/minidump/TestMiniDump.py (added) +++ lldb/trunk/test/functionalities/postmortem/minidump/TestMiniDump.py Wed Sep 16 13:17:11 2015 @@ -0,0 +1,42 @@ +""" +Test basics of mini dump debugging. +""" + +import unittest2 +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__) + + 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) + # TODO(amccarth): Check the process ID. + + 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") + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Added: lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz.cpp?rev=247829&view=auto ============================================================================== --- lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz.cpp (added) +++ lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz.cpp Wed Sep 16 13:17:11 2015 @@ -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; +} Added: lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp?rev=247829&view=auto ============================================================================== Binary files lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp (added) and lldb/trunk/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp Wed Sep 16 13:17:11 2015 differ Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=247829&r1=247828&r2=247829&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Wed Sep 16 13:17:11 2015 @@ -889,6 +889,10 @@ def skipIfHostWindows(func): """Decorate the item to skip tests that should be skipped on Windows.""" return skipIfHostPlatform(["windows"])(func) +def skipUnlessWindows(func): + """Decorate the item to skip tests that should be skipped on any non-Windows platform.""" + return skipUnlessPlatform(["windows"])(func) + def skipUnlessDarwin(func): """Decorate the item to skip tests that should be skipped on any non Darwin platform.""" return skipUnlessPlatform(getDarwinOSTriples())(func) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits