brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 6239e1a Raw
66 lines · python
1"""2Test lldb-dap stack trace containing x86 assembly3"""4 5import lldbdap_testcase6from lldbsuite.test import lldbplatformutil7from lldbsuite.test.decorators import skipUnlessArch, skipUnlessPlatform8from lldbsuite.test.lldbtest import line_number9 10 11class TestDAP_stacktrace_x86(lldbdap_testcase.DAPTestCaseBase):12    @skipUnlessArch("x86_64")13    @skipUnlessPlatform(["linux"] + lldbplatformutil.getDarwinOSTriples())14    def test_stacktrace_x86(self):15        """16        Tests that lldb-dap steps through correctly and the source lines are correct in x86 assembly.17        """18        program = self.getBuildArtifact("a.out")19        self.build_and_launch(20            program,21            initCommands=[22                "settings set target.process.thread.step-in-avoid-nodebug false"23            ],24        )25 26        source = "main.c"27        breakpoint_ids = self.set_source_breakpoints(28            source,29            [line_number(source, "// Break here")],30        )31        self.continue_to_breakpoints(breakpoint_ids)32        self.stepIn()33 34        frame = self.get_stackFrames()[0]35        self.assertEqual(36            frame["name"],37            "no_branch_func",38            "verify we are in the no_branch_func function",39        )40 41        self.assertEqual(frame["line"], 1, "verify we are at the start of the function")42        minimum_assembly_lines = (43            line_number(source, "Assembly end")44            - line_number(source, "Assembly start")45            + 146        )47        self.assertLessEqual(48            10,49            minimum_assembly_lines,50            "verify we have a reasonable number of assembly lines",51        )52 53        for i in range(2, minimum_assembly_lines):54            self.stepIn()55            frame = self.get_stackFrames()[0]56            self.assertEqual(57                frame["name"],58                "no_branch_func",59                "verify we are still in the no_branch_func function",60            )61            self.assertEqual(62                frame["line"],63                i,64                f"step in should advance a single line in the function to {i}",65            )66