changeset 16396:c6a13c1900fc

make "dbstep out" and "dbstep" after "dbstep in" work properly * pt-eval.cc (tree_evaluator::do_breakpoint): Recognize case of stepping into a parent frame. When stepping out, don't break unless at end of function in frame in which "dbstep out" command was issued.
author John W. Eaton <jwe@octave.org>
date Fri, 29 Mar 2013 22:00:57 -0400
parents fc491da603f6
children 649d0b75ec06
files libinterp/parse-tree/pt-eval.cc
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Fri Mar 29 22:37:01 2013 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Fri Mar 29 22:00:57 2013 -0400
@@ -1179,6 +1179,17 @@
             }
 
         }
+      else if (dbstep_flag == 1
+               && octave_call_stack::current_frame () < current_frame)
+        {
+          // We stepped out from the end of a function.
+
+          current_frame = octave_call_stack::current_frame ();
+
+          break_on_this_statement = true;
+
+          dbstep_flag = 0;
+        }
     }
   else if (dbstep_flag == -1)
     {
@@ -1192,9 +1203,14 @@
     }
   else if (dbstep_flag == -2)
     {
-      // We get here if we are doing a "dbstep out".
+      // We get here if we are doing a "dbstep out".  Check for end of
+      // function and whether the current frame is the same as the
+      // cached value because we want to step out from the frame where
+      // "dbstep out" was evaluated, not from any functions called from
+      // that frame.
 
-      if (is_end_of_fcn_or_script)
+      if (is_end_of_fcn_or_script
+          && octave_call_stack::current_frame () == current_frame)
         dbstep_flag = -1;
     }