xref: /llvm-project/lldb/test/API/python_api/lldbutil/process/TestPrintStackTraces.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
199451b44SJordan Rupprecht"""
299451b44SJordan RupprechtTest SBprocess and SBThread APIs with printing of the stack traces using lldbutil.
399451b44SJordan Rupprecht"""
499451b44SJordan Rupprecht
599451b44SJordan Rupprecht
699451b44SJordan Rupprechtimport lldb
799451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
899451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
999451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
1099451b44SJordan Rupprecht
1199451b44SJordan Rupprecht
1299451b44SJordan Rupprechtclass ThreadsStackTracesTestCase(TestBase):
1399451b44SJordan Rupprecht    def test_stack_traces(self):
1499451b44SJordan Rupprecht        """Test SBprocess and SBThread APIs with printing of the stack traces."""
1599451b44SJordan Rupprecht        self.build()
16*2238dcc3SJonas Devlieghere        (_, process, _, _) = lldbutil.run_to_source_breakpoint(
17*2238dcc3SJonas Devlieghere            self, "// BREAK HERE", lldb.SBFileSpec("main.cpp")
18*2238dcc3SJonas Devlieghere        )
1999451b44SJordan Rupprecht        stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
20*2238dcc3SJonas Devlieghere        self.expect(
21*2238dcc3SJonas Devlieghere            stacktraces,
22*2238dcc3SJonas Devlieghere            exe=False,
23*2238dcc3SJonas Devlieghere            substrs=["(int)x=4", "(int)y=6", "(int)x=3", "(int)argc=1"],
24*2238dcc3SJonas Devlieghere        )
25