45 lines · python
1"""2Test calling a function, stopping in the call, continue and gather the result on stop.3"""4 5import lldb6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class ExprCommandCallStopContinueTestCase(TestBase):11 def setUp(self):12 # Call super's setUp().13 TestBase.setUp(self)14 # Find the line number to break for main.c.15 16 def test(self):17 """Test gathering result from interrupted function call."""18 self.build()19 lldbutil.run_to_source_breakpoint(20 self, "// break here", lldb.SBFileSpec("main.cpp")21 )22 23 lldbutil.run_break_set_by_file_and_line(24 self,25 "main.cpp",26 line_number("main.cpp", '{5, "five"}'),27 num_expected_locations=-1,28 loc_exact=True,29 )30 31 self.expect(32 "expr -i false -- returnsFive()",33 error=True,34 substrs=["Expression execution hit a breakpoint: breakpoint"],35 )36 37 self.runCmd("continue", "Continue completed")38 self.expect(39 "thread list",40 substrs=[41 "stop reason = User Expression thread plan",42 r'Completed expression: (Five) $0 = (number = 5, name = "five")',43 ],44 )45