xref: /llvm-project/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
199451b44SJordan Rupprecht"""
299451b44SJordan RupprechtTests calling a function by basename
399451b44SJordan Rupprecht"""
499451b44SJordan Rupprecht
599451b44SJordan Rupprechtimport lldb
699451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
799451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
899451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
999451b44SJordan Rupprecht
1099451b44SJordan Rupprecht
1199451b44SJordan Rupprechtclass CallCPPFunctionTestCase(TestBase):
1299451b44SJordan Rupprecht    def setUp(self):
1399451b44SJordan Rupprecht        TestBase.setUp(self)
14*2238dcc3SJonas Devlieghere        self.line = line_number("main.cpp", "// breakpoint")
1599451b44SJordan Rupprecht
1699451b44SJordan Rupprecht    def test_with_run_command(self):
1799451b44SJordan Rupprecht        """Test calling a function by basename"""
1899451b44SJordan Rupprecht        self.build()
19*2238dcc3SJonas Devlieghere        lldbutil.run_to_source_breakpoint(
20*2238dcc3SJonas Devlieghere            self, "// breakpoint", lldb.SBFileSpec("main.cpp")
21*2238dcc3SJonas Devlieghere        )
2299451b44SJordan Rupprecht
2399451b44SJordan Rupprecht        # The stop reason of the thread should be breakpoint.
24*2238dcc3SJonas Devlieghere        self.expect(
25*2238dcc3SJonas Devlieghere            "thread list",
2699451b44SJordan Rupprecht            STOPPED_DUE_TO_BREAKPOINT,
27*2238dcc3SJonas Devlieghere            substrs=["stopped", "stop reason = breakpoint"],
28*2238dcc3SJonas Devlieghere        )
2999451b44SJordan Rupprecht
3099451b44SJordan Rupprecht        self.expect_expr("a_function_to_call()", result_type="int", result_value="0")
31