brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · e452bb5 Raw
55 lines · python
1"""Test that lldb can report the exception reason for threads in a corefile."""2 3import os4import re5import subprocess6 7import lldb8from lldbsuite.test.decorators import *9from lldbsuite.test.lldbtest import *10from lldbsuite.test import lldbutil11 12 13class TestCorefileExceptionReason(TestBase):14    @no_debug_info_test15    @skipUnlessDarwin16    @skipIf(archs=no_match(["arm64", "arm64e"]))17    @skipIfRemote18    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")23        )24 25        self.runCmd("continue")26 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)35 36        # Now load the corefile37        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")45 46        self.assertEqual(47            thread.stop_description, "ESR_EC_DABORT_EL0 (fault address: 0x0)"48        )49 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])55