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