2014-07-08 09:07:32 +08:00
|
|
|
"""
|
|
|
|
Test calling a function, stopping in the call, continue and gather the result on stop.
|
|
|
|
"""
|
|
|
|
|
2015-10-24 01:04:29 +08:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-11-04 03:20:39 +08:00
|
|
|
|
2015-10-23 04:06:20 +08:00
|
|
|
|
2014-07-08 09:07:32 +08:00
|
|
|
import lldb
|
2016-02-05 07:04:17 +08:00
|
|
|
from lldbsuite.test.decorators import *
|
2015-11-03 10:06:18 +08:00
|
|
|
from lldbsuite.test.lldbtest import *
|
2016-02-05 07:04:17 +08:00
|
|
|
from lldbsuite.test import lldbutil
|
2014-07-08 09:07:32 +08:00
|
|
|
|
|
|
|
class ExprCommandCallStopContinueTestCase(TestBase):
|
|
|
|
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
# Call super's setUp().
|
|
|
|
TestBase.setUp(self)
|
|
|
|
# Find the line number to break for main.c.
|
|
|
|
self.line = line_number('main.cpp',
|
|
|
|
'// Please test these expressions while stopped at this line:')
|
2016-08-12 17:39:22 +08:00
|
|
|
self.func_line = line_number ('main.cpp', '{5, "five"}')
|
2014-07-08 09:07:32 +08:00
|
|
|
|
2015-06-26 23:13:21 +08:00
|
|
|
@expectedFlakeyDarwin("llvm.org/pr20274")
|
2016-02-09 03:34:59 +08:00
|
|
|
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
|
2015-09-30 18:12:40 +08:00
|
|
|
def test(self):
|
2014-07-08 09:07:32 +08:00
|
|
|
"""Test gathering result from interrupted function call."""
|
2015-09-30 18:12:40 +08:00
|
|
|
self.build()
|
2014-07-08 09:07:32 +08:00
|
|
|
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
|
|
|
|
|
|
|
|
# Some versions of GCC encode two locations for the 'return' statement in main.cpp
|
|
|
|
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
|
|
|
|
|
2015-07-02 07:56:30 +08:00
|
|
|
self.runCmd("run", RUN_SUCCEEDED)
|
2014-07-08 09:07:32 +08:00
|
|
|
|
|
|
|
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.func_line, num_expected_locations=-1, loc_exact=True)
|
|
|
|
|
|
|
|
self.expect("expr -i false -- returnsFive()", error=True,
|
|
|
|
substrs = ['Execution was interrupted, reason: breakpoint'])
|
|
|
|
|
|
|
|
self.runCmd("continue", "Continue completed")
|
|
|
|
self.expect ("thread list",
|
|
|
|
substrs = ['stop reason = User Expression thread plan',
|
|
|
|
r'Completed expression: (Five) $0 = (number = 5, name = "five")'])
|