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.
9 from lldbsuite
.test
.decorators
import *
10 from lldbsuite
.test
.lldbtest
import *
11 from lldbsuite
.test
import lldbutil
14 class BuiltinTrapTestCase(TestBase
):
16 mydir
= TestBase
.compute_mydir(__file__
)
19 # Call super's setUp().
21 # Find the line number to break at.
22 self
.line
= line_number('main.cpp', '// Set break point at this line.')
24 # gcc generates incorrect linetable
25 @expectedFailureAll(archs
="arm", compiler
="gcc", triple
=".*-android")
26 @expectedFailureAll(oslist
=['linux'], archs
=['arm', 'aarch64'])
28 def test_with_run_command(self
):
29 """Test that LLDB handles a function with __builtin_trap correctly."""
31 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
33 lldbutil
.run_break_set_by_file_and_line(self
, "main.cpp", self
.line
,
34 num_expected_locations
=1,
37 self
.runCmd("run", RUN_SUCCEEDED
)
39 # The stop reason of the thread should be breakpoint.
40 self
.expect("thread list", STOPPED_DUE_TO_BREAKPOINT
,
42 'stop reason = breakpoint'])
44 # print backtrace, expect both 'bar' and 'main' functions to be listed
45 self
.expect('bt', substrs
=['bar', 'main'])
48 self
.runCmd("up", RUN_SUCCEEDED
)
51 self
.expect('p foo', substrs
=['= 5'])