[llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist...
[llvm-project.git] / lldb / test / API / macosx / corefile-exception-reason / TestCorefileExceptionReason.py
blobada74a11ffd7fa14cd40093ea13b3657b19e5ef7
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 @no_debug_info_test
15 @skipUnlessDarwin
16 @skipIf(archs=no_match(["arm64", "arm64e"]))
17 @skipIfRemote
18 def test(self):
19 corefile = self.getBuildArtifact("process.core")
20 self.build()
21 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
22 self, "// break here", lldb.SBFileSpec("main.cpp")
25 self.runCmd("continue")
27 self.runCmd("process save-core -s stack " + corefile)
28 live_tids = []
29 if self.TraceOn():
30 self.runCmd("thread list")
31 for t in process.threads:
32 live_tids.append(t.GetThreadID())
33 process.Kill()
34 self.dbg.DeleteTarget(target)
36 # Now load the corefile
37 target = self.dbg.CreateTarget("")
38 process = target.LoadCore(corefile)
39 thread = process.GetSelectedThread()
40 self.assertTrue(process.GetSelectedThread().IsValid())
41 if self.TraceOn():
42 self.runCmd("image list")
43 self.runCmd("bt")
44 self.runCmd("fr v")
46 self.assertEqual(
47 thread.GetStopDescription(256), "ESR_EC_DABORT_EL0 (fault address: 0x0)"
50 if self.TraceOn():
51 self.runCmd("thread list")
52 for i in range(process.GetNumThreads()):
53 t = process.GetThreadAtIndex(i)
54 self.assertEqual(t.GetThreadID(), live_tids[i])