xref: /llvm-project/lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test that breakpoints in an IT instruction don't fire if their condition is
3false.
4"""
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class TestBreakpointIt(TestBase):
14    NO_DEBUG_INFO_TESTCASE = True
15
16    @skipIf(archs=no_match(["arm"]))
17    @skipIf(archs=["arm64", "arm64e", "arm64_32"])
18    def test_false(self):
19        self.build()
20        exe = self.getBuildArtifact("a.out")
21
22        self.runCmd("target create %s" % exe)
23        lldbutil.run_break_set_by_symbol(
24            self, "bkpt_false", extra_options="--skip-prologue 0"
25        )
26
27        self.runCmd("run")
28        self.assertState(
29            self.process().GetState(), lldb.eStateExited, "Breakpoint does not get hit"
30        )
31
32    @skipIf(archs=no_match(["arm"]))
33    @skipIf(archs=["arm64", "arm64e", "arm64_32"])
34    def test_true(self):
35        self.build()
36        exe = self.getBuildArtifact("a.out")
37
38        self.runCmd("target create %s" % exe)
39        bpid = lldbutil.run_break_set_by_symbol(
40            self, "bkpt_true", extra_options="--skip-prologue 0"
41        )
42
43        self.runCmd("run")
44        self.assertIsNotNone(
45            lldbutil.get_one_thread_stopped_at_breakpoint_id(self.process(), bpid)
46        )
47