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    def test_stack_traces(self):
18        """Test SBprocess and SBThread APIs with printing of the stack traces."""
19        self.build()
20        (_, process, _, _) = lldbutil.run_to_source_breakpoint(self,
21                "// BREAK HERE", lldb.SBFileSpec("main.cpp"))
22        stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
23        self.expect(stacktraces, exe=False,
24                    substrs=['(int)x=4', '(int)y=6', '(int)x=3', '(int)argc=1'])
25