Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / linux / builtin_trap / TestBuiltinTrap.py
blob9bad2a15bf357f85c3b55c342cb1fc7d9476acea
1 """
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.
4 """
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class 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.")
20 # gcc generates incorrect linetable
21 @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android")
22 @expectedFailureAll(archs=["aarch64"], oslist=no_match(["freebsd", "linux"]))
23 @skipIfWindows
24 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)
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.
36 self.expect(
37 "thread list",
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"])
45 # go up one frame
46 self.runCmd("up", RUN_SUCCEEDED)
48 # evaluate a local
49 self.expect("expression foo", substrs=["= 5"])