]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / thread / backtrace_all / TestBacktraceAll.py
1 """
2 Test regression for Bug 25251.
3 """
4
5 import os, time
6 import unittest2
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
11
12 class BreakpointAfterJoinTestCase(TestBase):
13
14     mydir = TestBase.compute_mydir(__file__)
15
16     def setUp(self):
17         # Call super's setUp().
18         TestBase.setUp(self)
19         # Find the line number for our breakpoint.
20         self.breakpoint = line_number('ParallelTask.cpp', '// Set breakpoint here')
21     
22     @skipIfTargetAndroid(archs=["arm"]) # The android-arm compiler can't compile the inferior
23                                         # because of an issue around std::future.
24                                         # TODO: Change the test to don't depend on std::future<T>
25     def test(self):
26         """Test breakpoint handling after a thread join."""
27         self.build(dictionary=self.getBuildFlags())
28
29         exe = os.path.join(os.getcwd(), "a.out")
30         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
31
32         # This should create a breakpoint
33         lldbutil.run_break_set_by_file_and_line (self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1)
34
35         # The breakpoint list should show 1 location.
36         self.expect("breakpoint list -f", "Breakpoint location shown correctly",
37             substrs = ["1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" % self.breakpoint])
38
39         # Run the program.
40         self.runCmd("run", RUN_SUCCEEDED)
41
42         # The stop reason of the thread should be breakpoint.
43         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
44             substrs = ['stopped',
45                        'stop reason = breakpoint'])
46
47         # This should not result in a segmentation fault
48         self.expect("thread backtrace all", STOPPED_DUE_TO_BREAKPOINT,
49             substrs = ["stop reason = breakpoint 1."])
50
51         # Run to completion
52         self.runCmd("continue")
53
54 if __name__ == '__main__':
55     import atexit
56     lldb.SBDebugger.Initialize()
57     atexit.register(lambda: lldb.SBDebugger.Terminate())
58     unittest2.main()