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    @skipIf(archs=no_match(["arm"]))
16    @skipIf(archs=["arm64"])
17    @skipIfDarwinEmbedded   # codegen on darwin always defaults to thumb for armv7/armv7k targets
18    def test_breakpoint(self):
19        self.build()
20        exe = self.getBuildArtifact("a.out")
21        line = line_number('main.c', '// Set break point at this line.')
22
23        self.runCmd("target create %s" % exe)
24        bpid = lldbutil.run_break_set_by_file_and_line(self, "main.c", line)
25
26        self.runCmd("run")
27
28        self.assertIsNotNone(lldbutil.get_one_thread_stopped_at_breakpoint_id(
29            self.process(), bpid), "Process is not stopped at breakpoint")
30
31        self.process().Continue()
32        self.assertState(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)
33