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.
6 from __future__ import print_function
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
16 class BuiltinTrapTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 # Call super's setUp().
23 # Find the line number to break at.
24 self.line = line_number('main.cpp', '// Set break point at this line.')
26 @expectedFailureAll("llvm.org/pr15936", compiler="gcc", compiler_version=["<=","4.6"])
27 @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android") # gcc generates incorrect linetable
28 @expectedFailureAll(oslist=['linux'], archs=['arm'])
30 def test_with_run_command(self):
31 """Test that LLDB handles a function with __builtin_trap correctly."""
33 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
35 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line,
36 num_expected_locations=1,
39 self.runCmd("run", RUN_SUCCEEDED)
41 # The stop reason of the thread should be breakpoint.
42 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
44 'stop reason = breakpoint'])
46 # print backtrace, expect both 'bar' and 'main' functions to be listed
47 self.expect('bt', substrs = ['bar', 'main'])
50 self.runCmd("up", RUN_SUCCEEDED)
53 self.expect('p foo', substrs = ['= 5'])