xref: /llvm-project/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Tests calling a function by basename
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class CallCPPFunctionTestCase(TestBase):
12    def setUp(self):
13        TestBase.setUp(self)
14        self.line = line_number("main.cpp", "// breakpoint")
15
16    def test_with_run_command(self):
17        """Test calling a function by basename"""
18        self.build()
19        lldbutil.run_to_source_breakpoint(
20            self, "// breakpoint", lldb.SBFileSpec("main.cpp")
21        )
22
23        # The stop reason of the thread should be breakpoint.
24        self.expect(
25            "thread list",
26            STOPPED_DUE_TO_BREAKPOINT,
27            substrs=["stopped", "stop reason = breakpoint"],
28        )
29
30        self.expect_expr("a_function_to_call()", result_type="int", result_value="0")
31