1"""
2Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class ThreadsStackTracesTestCase(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    @add_test_categories(['pyapi'])
18    def test_stack_traces(self):
19        """Test SBprocess and SBThread APIs with printing of the stack traces."""
20        self.build()
21        (_, process, _, _) = lldbutil.run_to_source_breakpoint(self,
22                "// BREAK HERE", lldb.SBFileSpec("main.cpp"))
23        stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
24        self.expect(stacktraces, exe=False,
25                    substrs=['(int)x=4', '(int)y=6', '(int)x=3', '(int)argc=1'])
26