]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py
Vendor import of lldb trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / linux / builtin_trap / TestBuiltinTrap.py
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 """
5
6 from __future__ import print_function
7
8
9 import os
10 import lldb
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
14
15
16 class BuiltinTrapTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     def setUp(self):
21         # Call super's setUp().
22         TestBase.setUp(self)
23         # Find the line number to break at.
24         self.line = line_number('main.cpp', '// Set break point at this line.')
25
26     # gcc generates incorrect linetable
27     @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android")
28     @expectedFailureAll(oslist=['linux'], archs=['arm'])
29     @skipIfWindows
30     def test_with_run_command(self):
31         """Test that LLDB handles a function with __builtin_trap correctly."""
32         self.build()
33         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
34
35         lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line,
36                                                 num_expected_locations=1,
37                                                 loc_exact=True)
38
39         self.runCmd("run", RUN_SUCCEEDED)
40
41         # The stop reason of the thread should be breakpoint.
42         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43                     substrs=['stopped',
44                              'stop reason = breakpoint'])
45
46         # print backtrace, expect both 'bar' and 'main' functions to be listed
47         self.expect('bt', substrs=['bar', 'main'])
48
49         # go up one frame
50         self.runCmd("up", RUN_SUCCEEDED)
51
52         # evaluate a local
53         self.expect('p foo', substrs=['= 5'])