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