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 NO_DEBUG_INFO_TESTCASE = True 21 22 def test_wow64_mini_dump(self): 23 """Test that lldb can read the process information from the minidump.""" 24 # target create -c fizzbuzz_wow64.dmp 25 target = self.dbg.CreateTarget("") 26 process = target.LoadCore("fizzbuzz_wow64.dmp") 27 self.assertTrue(process, PROCESS_IS_VALID) 28 self.assertEqual(process.GetNumThreads(), 1) 29 self.assertEqual(process.GetProcessID(), 0x1E9C) 30 31 def test_thread_info_in_wow64_mini_dump(self): 32 """Test that lldb can read the thread information from the minidump.""" 33 # target create -c fizzbuzz_wow64.dmp 34 target = self.dbg.CreateTarget("") 35 process = target.LoadCore("fizzbuzz_wow64.dmp") 36 # This process crashed due to an access violation (0xc0000005), but the 37 # minidump doesn't have an exception record--perhaps the crash handler 38 # ate it. 39 # TODO: See if we can recover the exception information from the TEB, 40 # which, according to Windbg, has a pointer to an exception list. 41 42 # In the dump, none of the threads are stopped, so we cannot use 43 # lldbutil.get_stopped_thread. 44 thread = process.GetThreadAtIndex(0) 45 self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) 46 47 def test_stack_info_in_wow64_mini_dump(self): 48 """Test that we can see a trivial stack in a VS-generate mini dump.""" 49 # target create -c fizzbuzz_no_heap.dmp 50 target = self.dbg.CreateTarget("") 51 process = target.LoadCore("fizzbuzz_wow64.dmp") 52 self.assertGreaterEqual(process.GetNumThreads(), 1) 53 # This process crashed due to an access violation (0xc0000005), but the 54 # minidump doesn't have an exception record--perhaps the crash handler 55 # ate it. 56 # TODO: See if we can recover the exception information from the TEB, 57 # which, according to Windbg, has a pointer to an exception list. 58 59 # In the dump, none of the threads are stopped, so we cannot use 60 # lldbutil.get_stopped_thread. 61 thread = process.GetThreadAtIndex(0) 62 # The crash is in main, so there should be at least one frame on the 63 # stack. 64 self.assertGreaterEqual(thread.GetNumFrames(), 1) 65 frame = thread.GetFrameAtIndex(0) 66 self.assertTrue(frame.IsValid()) 67 pc = frame.GetPC() 68 eip = frame.FindRegister("pc") 69 self.assertTrue(eip.IsValid()) 70 self.assertEqual(pc, eip.GetValueAsUnsigned()) 71