Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / macosx / corefile-exception-reason / TestCorefileExceptionReason.py
blob58f6c36ccfcc64f17dcaf6ffe0632960951c4c4c
1 """Test that lldb can report the exception reason for threads in a corefile."""
3 import os
4 import re
5 import subprocess
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class TestCorefileExceptionReason(TestBase):
14 @skipIfOutOfTreeDebugserver # newer debugserver required for these qMemoryRegionInfo types
15 @no_debug_info_test
16 @skipUnlessDarwin
17 @skipIf(archs=no_match(["arm64", "arm64e"]))
18 @skipIfRemote
19 def test(self):
20 corefile = self.getBuildArtifact("process.core")
21 self.build()
22 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
23 self, "// break here", lldb.SBFileSpec("main.cpp")
26 self.runCmd("continue")
28 self.runCmd("process save-core -s stack " + corefile)
29 live_tids = []
30 if self.TraceOn():
31 self.runCmd("thread list")
32 for t in process.threads:
33 live_tids.append(t.GetThreadID())
34 process.Kill()
35 self.dbg.DeleteTarget(target)
37 # Now load the corefile
38 target = self.dbg.CreateTarget("")
39 process = target.LoadCore(corefile)
40 thread = process.GetSelectedThread()
41 self.assertTrue(process.GetSelectedThread().IsValid())
42 if self.TraceOn():
43 self.runCmd("image list")
44 self.runCmd("bt")
45 self.runCmd("fr v")
47 self.assertEqual(
48 thread.GetStopDescription(256), "ESR_EC_DABORT_EL0 (fault address: 0x0)"
51 if self.TraceOn():
52 self.runCmd("thread list")
53 for i in range(process.GetNumThreads()):
54 t = process.GetThreadAtIndex(i)
55 self.assertEqual(t.GetThreadID(), live_tids[i])