brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 5fdf7b4 Raw
50 lines · python
1"""2Test lldb ability to unwind a stack with a function containing a call to the3'__builtin_trap' intrinsic, which GCC (4.6) encodes to an illegal opcode.4"""5 6 7import lldb8from lldbsuite.test.decorators import *9from lldbsuite.test.lldbtest import *10from lldbsuite.test import lldbutil11 12 13class BuiltinTrapTestCase(TestBase):14    def setUp(self):15        # Call super's setUp().16        TestBase.setUp(self)17        # Find the line number to break at.18        self.line = line_number("main.cpp", "// Set break point at this line.")19 20    # gcc generates incorrect linetable21    @expectedFailureAll(archs="arm$", compiler="gcc", triple=".*-android")22    @expectedFailureAll(archs=["aarch64"], oslist=no_match(["freebsd", "linux"]))23    @skipIfWindows24    def test_with_run_command(self):25        """Test that LLDB handles a function with __builtin_trap correctly."""26        self.build()27        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)28 29        lldbutil.run_break_set_by_file_and_line(30            self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True31        )32 33        self.runCmd("run", RUN_SUCCEEDED)34 35        # The stop reason of the thread should be breakpoint.36        self.expect(37            "thread list",38            STOPPED_DUE_TO_BREAKPOINT,39            substrs=["stopped", "stop reason = breakpoint"],40        )41 42        # print backtrace, expect both 'bar' and 'main' functions to be listed43        self.expect("bt", substrs=["bar", "main"])44 45        # go up one frame46        self.runCmd("up", RUN_SUCCEEDED)47 48        # evaluate a local49        self.expect("expression foo", substrs=["= 5"])50