1""" 2Test basics of a mini dump taken of a 32-bit process running in WoW64 3 4WoW64 is the subsystem that lets 32-bit processes run in 64-bit Windows. If you 5capture a mini dump of a process running under WoW64 with a 64-bit debugger, you 6end up with a dump of the WoW64 layer. In that case, LLDB must do extra work to 7get the 32-bit register contexts. 8""" 9 10from six import iteritems 11 12 13import lldb 14from lldbsuite.test.decorators import * 15from lldbsuite.test.lldbtest import * 16from lldbsuite.test import lldbutil 17 18 19class Wow64MiniDumpTestCase(TestBase): 20 21 mydir = TestBase.compute_mydir(__file__) 22 NO_DEBUG_INFO_TESTCASE = True 23 24 def test_wow64_mini_dump(self): 25 """Test that lldb can read the process information from the minidump.""" 26 # target create -c fizzbuzz_wow64.dmp 27 target = self.dbg.CreateTarget("") 28 process = target.LoadCore("fizzbuzz_wow64.dmp") 29 self.assertTrue(process, PROCESS_IS_VALID) 30 self.assertEqual(process.GetNumThreads(), 1) 31 self.assertEqual(process.GetProcessID(), 0x1E9C) 32 33 def test_thread_info_in_wow64_mini_dump(self): 34 """Test that lldb can read the thread information from the minidump.""" 35 # target create -c fizzbuzz_wow64.dmp 36 target = self.dbg.CreateTarget("") 37 process = target.LoadCore("fizzbuzz_wow64.dmp") 38 # This process crashed due to an access violation (0xc0000005), but the 39 # minidump doesn't have an exception record--perhaps the crash handler 40 # ate it. 41 # TODO: See if we can recover the exception information from the TEB, 42 # which, according to Windbg, has a pointer to an exception list. 43 44 # In the dump, none of the threads are stopped, so we cannot use 45 # lldbutil.get_stopped_thread. 46 thread = process.GetThreadAtIndex(0) 47 self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) 48 49 def test_stack_info_in_wow64_mini_dump(self): 50 """Test that we can see a trivial stack in a VS-generate mini dump.""" 51 # target create -c fizzbuzz_no_heap.dmp 52 target = self.dbg.CreateTarget("") 53 process = target.LoadCore("fizzbuzz_wow64.dmp") 54 self.assertGreaterEqual(process.GetNumThreads(), 1) 55 # This process crashed due to an access violation (0xc0000005), but the 56 # minidump doesn't have an exception record--perhaps the crash handler 57 # ate it. 58 # TODO: See if we can recover the exception information from the TEB, 59 # which, according to Windbg, has a pointer to an exception list. 60 61 # In the dump, none of the threads are stopped, so we cannot use 62 # lldbutil.get_stopped_thread. 63 thread = process.GetThreadAtIndex(0) 64 # The crash is in main, so there should be at least one frame on the 65 # stack. 66 self.assertGreaterEqual(thread.GetNumFrames(), 1) 67 frame = thread.GetFrameAtIndex(0) 68 self.assertTrue(frame.IsValid()) 69 pc = frame.GetPC() 70 eip = frame.FindRegister("pc") 71 self.assertTrue(eip.IsValid()) 72 self.assertEqual(pc, eip.GetValueAsUnsigned()) 73