Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 1 | """ |
| 2 | Tests calling a function by basename |
| 3 | """ |
| 4 | |
| 5 | import lldb |
| 6 | from lldbtest import * |
| 7 | import lldbutil |
| 8 | |
| 9 | class CallCPPFunctionTestCase(TestBase): |
| 10 | |
Greg Clayton | 4570d3e | 2013-12-10 23:19:29 +0000 | [diff] [blame] | 11 | mydir = TestBase.compute_mydir(__file__) |
Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 12 | |
Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 13 | def setUp(self): |
| 14 | TestBase.setUp(self) |
| 15 | self.line = line_number('main.cpp', '// breakpoint') |
| 16 | |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 17 | @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") |
| 18 | def test_with_run_command(self): |
Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 19 | """Test calling a function by basename""" |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 20 | self.build() |
Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 21 | 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 Callanan | 05834cd | 2015-07-01 23:56:30 +0000 | [diff] [blame] | 25 | self.runCmd("process launch", RUN_SUCCEEDED) |
Sean Callanan | 8d285ad | 2013-04-30 22:05:15 +0000 | [diff] [blame] | 26 | |
| 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 | |
| 35 | if __name__ == '__main__': |
| 36 | import atexit |
| 37 | lldb.SBDebugger.Initialize() |
| 38 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 39 | unittest2.main() |