diff options
Diffstat (limited to 'lldb/test/lang/c/stepping/TestStepAndBreakpoints.py')
| -rw-r--r-- | lldb/test/lang/c/stepping/TestStepAndBreakpoints.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py index efecc9394a1..3f5a74f0a97 100644 --- a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py +++ b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py @@ -161,6 +161,71 @@ class TestObjCStepping(TestBase): self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == current_line) self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec() == current_file) + # Now we are going to test step in targetting a function: + + break_in_b.SetEnabled (False) + + break_before_complex_1 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targetting b.', self.main_source_spec) + self.assertTrue(break_before_complex_1, VALID_BREAKPOINT) + + break_before_complex_2 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targetting complex.', self.main_source_spec) + self.assertTrue(break_before_complex_2, VALID_BREAKPOINT) + + break_before_complex_3 = target.BreakpointCreateBySourceRegex ('// Stop here to step targetting b and hitting breakpoint.', self.main_source_spec) + self.assertTrue(break_before_complex_3, VALID_BREAKPOINT) + + break_before_complex_4 = target.BreakpointCreateBySourceRegex ('// Stop here to make sure bogus target steps over.', self.main_source_spec) + self.assertTrue(break_before_complex_4, VALID_BREAKPOINT) + + threads = lldbutil.continue_to_breakpoint(process, break_before_complex_1) + self.assertTrue (len(threads) == 1) + thread = threads[0] + break_before_complex_1.SetEnabled(False) + + thread.StepInto ("b") + self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b") + + # Now continue out and stop at the next call to complex. This time step all the way into complex: + threads = lldbutil.continue_to_breakpoint (process, break_before_complex_2) + self.assertTrue (len(threads) == 1) + thread = threads[0] + break_before_complex_2.SetEnabled(False) + + thread.StepInto ("complex") + self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "complex") + + # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targetting b: + threads = lldbutil.continue_to_breakpoint (process, break_before_complex_3) + self.assertTrue (len(threads) == 1) + thread = threads[0] + break_before_complex_3.SetEnabled(False) + + break_at_start_of_a = target.BreakpointCreateByName ('a') + break_at_start_of_c = target.BreakpointCreateByName ('c') + + thread.StepInto ("b") + threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonBreakpoint); + + self.assertTrue (len(threads) == 1) + thread = threads[0] + stop_break_id = thread.GetStopReasonDataAtIndex(0) + self.assertTrue(stop_break_id == break_at_start_of_a.GetID() or stop_break_id == break_at_start_of_c.GetID()) + + break_at_start_of_a.SetEnabled(False) + break_at_start_of_c.SetEnabled(False) + + process.Continue() + self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b") + + # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targetting b: + threads = lldbutil.continue_to_breakpoint (process, break_before_complex_4) + self.assertTrue (len(threads) == 1) + thread = threads[0] + break_before_complex_4.SetEnabled(False) + + thread.StepInto("NoSuchFunction") + self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main") + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() |

