Jim Ingham | 30fadaf | 2014-07-08 01:07:32 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test calling a function, stopping in the call, continue and gather the result on stop. |
| 3 | """ |
| 4 | |
Zachary Turner | 35d017f | 2015-10-23 17:04:29 +0000 | [diff] [blame^] | 5 | from __future__ import print_function |
| 6 | |
Zachary Turner | 77db4a8 | 2015-10-22 20:06:20 +0000 | [diff] [blame] | 7 | import lldb_shared |
| 8 | |
Jim Ingham | 30fadaf | 2014-07-08 01:07:32 +0000 | [diff] [blame] | 9 | import lldb |
| 10 | import lldbutil |
| 11 | from lldbtest import * |
| 12 | |
| 13 | class ExprCommandCallStopContinueTestCase(TestBase): |
| 14 | |
| 15 | mydir = TestBase.compute_mydir(__file__) |
| 16 | |
| 17 | def setUp(self): |
| 18 | # Call super's setUp(). |
| 19 | TestBase.setUp(self) |
| 20 | # Find the line number to break for main.c. |
| 21 | self.line = line_number('main.cpp', |
| 22 | '// Please test these expressions while stopped at this line:') |
| 23 | self.func_line = line_number ('main.cpp', |
| 24 | '{ 5, "five" }') |
| 25 | |
Vince Harron | 7ac3ea4 | 2015-06-26 15:13:21 +0000 | [diff] [blame] | 26 | @expectedFlakeyDarwin("llvm.org/pr20274") |
Zachary Turner | 2878bf4 | 2015-08-18 20:01:28 +0000 | [diff] [blame] | 27 | @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 28 | def test(self): |
Jim Ingham | 30fadaf | 2014-07-08 01:07:32 +0000 | [diff] [blame] | 29 | """Test gathering result from interrupted function call.""" |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 30 | self.build() |
Jim Ingham | 30fadaf | 2014-07-08 01:07:32 +0000 | [diff] [blame] | 31 | self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) |
| 32 | |
| 33 | # Some versions of GCC encode two locations for the 'return' statement in main.cpp |
| 34 | lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) |
| 35 | |
Sean Callanan | 05834cd | 2015-07-01 23:56:30 +0000 | [diff] [blame] | 36 | self.runCmd("run", RUN_SUCCEEDED) |
Jim Ingham | 30fadaf | 2014-07-08 01:07:32 +0000 | [diff] [blame] | 37 | |
| 38 | lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.func_line, num_expected_locations=-1, loc_exact=True) |
| 39 | |
| 40 | self.expect("expr -i false -- returnsFive()", error=True, |
| 41 | substrs = ['Execution was interrupted, reason: breakpoint']) |
| 42 | |
| 43 | self.runCmd("continue", "Continue completed") |
| 44 | self.expect ("thread list", |
| 45 | substrs = ['stop reason = User Expression thread plan', |
| 46 | r'Completed expression: (Five) $0 = (number = 5, name = "five")']) |