brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · c2efc73 Raw
51 lines · python
1"""2Test that step-inst over a crash behaves correctly.3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class CrashDuringStepTestCase(TestBase):13    def setUp(self):14        TestBase.setUp(self)15        self.breakpoint = line_number("main.cpp", "// Set breakpoint here")16 17    # IO error due to breakpoint at invalid address18    @expectedFailureAll(triple=re.compile("^mips"))19    @skipIf(oslist=["windows"], archs=["aarch64"])20    def test_step_inst_with(self):21        """Test thread creation during step-inst handling."""22        self.build()23        exe = self.getBuildArtifact("a.out")24 25        target = self.dbg.CreateTarget(exe)26        self.assertTrue(target and target.IsValid(), "Target is valid")27 28        self.bp_num = lldbutil.run_break_set_by_file_and_line(29            self, "main.cpp", self.breakpoint, num_expected_locations=130        )31 32        # Run the program.33        process = target.LaunchSimple(None, None, self.get_process_working_directory())34        self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)35 36        # The stop reason should be breakpoint.37        self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)38        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)39        self.assertTrue(thread.IsValid(), STOPPED_DUE_TO_BREAKPOINT)40 41        # Keep stepping until the inferior crashes42        while (43            process.GetState() == lldb.eStateStopped44            and not lldbutil.is_thread_crashed(self, thread)45        ):46            thread.StepInstruction(False)47 48        self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)49        self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed")50        process.Kill()51