brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 5b00298 Raw
45 lines · python
1"""2Test that we can set up software breakpoint even if we failed to decode and execute instruction3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class TestBreakpointIllegal(TestBase):12    @skipIf(archs=no_match(["rv64gc"]))13    def test_4(self):14        self.build()15        (target, process, cur_thread, bkpt) = lldbutil.run_to_source_breakpoint(16            self, "main", lldb.SBFileSpec("main.c")17        )18        self.runCmd("thread step-inst")19        # we need to step more, as some compilers do not set appropriate debug info.20        while cur_thread.stop_description == "instruction step into":21            self.runCmd("thread step-inst")22        # The stop reason of the thread should be illegal opcode.23        self.expect(24            "thread list",25            STOPPED_DUE_TO_SIGNAL,26            substrs=["stopped", "stop reason = signal SIGILL: illegal opcode"],27        )28 29    @skipIf(archs=no_match(["rv64gc"]))30    def test_2(self):31        self.build(dictionary={"C_SOURCES": "compressed.c", "EXE": "compressed.x"})32        (target, process, cur_thread, bkpt) = lldbutil.run_to_source_breakpoint(33            self, "main", lldb.SBFileSpec("compressed.c"), exe_name="compressed.x"34        )35        self.runCmd("thread step-inst")36        # we need to step more, as some compilers do not set appropriate debug info.37        while cur_thread.stop_description == "instruction step into":38            self.runCmd("thread step-inst")39        # The stop reason of the thread should be illegal opcode.40        self.expect(41            "thread list",42            STOPPED_DUE_TO_SIGNAL,43            substrs=["stopped", "stop reason = signal SIGILL: illegal opcode"],44        )45