1"""
2Test that breakpoints correctly work in an thumb function in an arbitrary
3named codesection.
4"""
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class TestBreakpointThumbCodesection(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    @skipIf(archs=no_match(["arm"]))
18    @skipIf(archs=["arm64"])
19    @skipIfDarwinEmbedded   # codegen on darwin always defaults to thumb for armv7/armv7k targets
20    def test_breakpoint(self):
21        self.build()
22        exe = self.getBuildArtifact("a.out")
23        line = line_number('main.c', '// Set break point at this line.')
24
25        self.runCmd("target create %s" % exe)
26        bpid = lldbutil.run_break_set_by_file_and_line(self, "main.c", line)
27
28        self.runCmd("run")
29
30        self.assertIsNotNone(lldbutil.get_one_thread_stopped_at_breakpoint_id(
31            self.process(), bpid), "Process is not stopped at breakpoint")
32
33        self.process().Continue()
34        self.assertEqual(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)
35