2 Test lldb ability to unwind a stack with a function containing a call to the
3 '__builtin_trap' intrinsic, which GCC (4.6) encodes to an illegal opcode.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
13 class BuiltinTrapTestCase(TestBase
):
15 # Call super's setUp().
17 # Find the line number to break at.
18 self
.line
= line_number("main.cpp", "// Set break point at this line.")
20 # gcc generates incorrect linetable
21 @expectedFailureAll(archs
="arm", compiler
="gcc", triple
=".*-android")
22 @expectedFailureAll(archs
=["aarch64"], oslist
=no_match(["freebsd", "linux"]))
24 def test_with_run_command(self
):
25 """Test that LLDB handles a function with __builtin_trap correctly."""
27 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
29 lldbutil
.run_break_set_by_file_and_line(
30 self
, "main.cpp", self
.line
, num_expected_locations
=1, loc_exact
=True
33 self
.runCmd("run", RUN_SUCCEEDED
)
35 # The stop reason of the thread should be breakpoint.
38 STOPPED_DUE_TO_BREAKPOINT
,
39 substrs
=["stopped", "stop reason = breakpoint"],
42 # print backtrace, expect both 'bar' and 'main' functions to be listed
43 self
.expect("bt", substrs
=["bar", "main"])
46 self
.runCmd("up", RUN_SUCCEEDED
)
49 self
.expect("expression foo", substrs
=["= 5"])