brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · bc740e9 Raw
47 lines · python
1"""2Make sure that we can step in across an arm64 branch island3"""4 5 6import lldb7import lldbsuite.test.lldbutil as lldbutil8from lldbsuite.test.lldbtest import *9from lldbsuite.test.decorators import *10 11 12class TestBranchIslandStepping(TestBase):13    NO_DEBUG_INFO_TESTCASE = True14 15    @skipUnlessAppleSilicon16    def test_step_in_branch_island(self):17        """Make sure we can step in across a branch island"""18        self.build()19        self.main_source_file = lldb.SBFileSpec("main.c")20        self.do_test()21 22    def do_test(self):23        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(24            self, "Set a breakpoint here", self.main_source_file25        )26 27        # Make sure that we did manage to generate a branch island for foo:28        syms = target.FindSymbols("foo.island", lldb.eSymbolTypeCode)29        self.assertEqual(len(syms), 1, "We did generate an island for foo")30        # There's a bug in the Xcode 15.2 linker, where it did not emit31        # "function starts" entries for the branch island symbols, which32        # causes lldb to set the range of the previous non-island symbol to33        # encompass the range of the branch island symbols.  If we encounter34        # that bug, then we won't successfully do the step in.  Test for35        # that here - if the symbol doesn't round-trip from36        # name->address->name then the rest of the test can't pass.37        island_sym_ctx = syms[0]38        sym_addr = island_sym_ctx.symbol.addr39        resolved_name = sym_addr.symbol.name40        if resolved_name != "foo.island":41            self.skipTest("Encountered overlapping symbol linker bug")42        thread.StepInto()43        stop_frame = thread.frames[0]44        self.assertIn("foo", stop_frame.name, "Stepped into foo")45        var = stop_frame.FindVariable("a_variable_in_foo")46        self.assertTrue(var.IsValid(), "Found the variable in foo")47