blob: 6adbcd6f7900c3432e257f1a6ecd9a19dc786f7d [file] [log] [blame]
Sean Callanan8d285ad2013-04-30 22:05:15 +00001"""
2Tests calling a function by basename
3"""
4
5import lldb
6from lldbtest import *
7import lldbutil
8
9class CallCPPFunctionTestCase(TestBase):
10
Greg Clayton4570d3e2013-12-10 23:19:29 +000011 mydir = TestBase.compute_mydir(__file__)
Sean Callanan8d285ad2013-04-30 22:05:15 +000012
Sean Callanan8d285ad2013-04-30 22:05:15 +000013 def setUp(self):
14 TestBase.setUp(self)
15 self.line = line_number('main.cpp', '// breakpoint')
16
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000017 @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows")
18 def test_with_run_command(self):
Sean Callanan8d285ad2013-04-30 22:05:15 +000019 """Test calling a function by basename"""
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000020 self.build()
Sean Callanan8d285ad2013-04-30 22:05:15 +000021 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
22
23 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
24
Sean Callanan05834cd2015-07-01 23:56:30 +000025 self.runCmd("process launch", RUN_SUCCEEDED)
Sean Callanan8d285ad2013-04-30 22:05:15 +000026
27 # The stop reason of the thread should be breakpoint.
28 self.expect("thread list",
29 STOPPED_DUE_TO_BREAKPOINT,
30 substrs = ['stopped', 'stop reason = breakpoint'])
31
32 self.expect("expression -- a_function_to_call()",
33 startstr = "(int) $0 = 0")
34
35if __name__ == '__main__':
36 import atexit
37 lldb.SBDebugger.Initialize()
38 atexit.register(lambda: lldb.SBDebugger.Terminate())
39 unittest2.main()