changeset 10186:095a1e670e68

make dbstep work with keyboard function
author John W. Eaton <jwe@octave.org>
date Fri, 22 Jan 2010 07:30:44 -0500
parents 455759a5fcbe
children a44d15813a39
files src/ChangeLog src/debug.cc src/input.cc src/pt-eval.cc src/pt-eval.h src/toplev.cc
diffstat 6 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/ChangeLog	Fri Jan 22 07:30:44 2010 -0500
@@ -1,3 +1,15 @@
+2010-01-22  John W. Eaton  <jwe@octave.org>
+
+	* debug.cc (Fdbcont, Fdbquit): Call reset_debug_state.
+	(Fdbquit): Set Vdebugging to false.
+	* input.cc (Fkeyboard): Set tree_evaluator::debug_state to true.
+	Set tree_evaluator::current_frame to the initial stack frame
+	that is active for debugging commands.
+	* pt-eval.cc (tree_evaluator::reset_debug_state): New function.
+	* pt-eval.h (tree_evaluator::reset_debug_state): Provide decl.
+	* toplev.cc (main_loop): Call tree_evaluator::reset_debug_state
+	if at top level.
+
 2010-01-22  Jaroslav Hajek  <highegg@gmail.com>
 
 	* data.cc (Fnorm): Don't special-case empty matrix.
--- a/src/debug.cc	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/debug.cc	Fri Jan 22 07:30:44 2010 -0500
@@ -1075,7 +1075,7 @@
 	{
 	  Vdebugging = false;
 
-	  tree_evaluator::dbstep_flag = 0;
+          tree_evaluator::reset_debug_state ();
 	}
       else
 	print_usage ();
@@ -1097,7 +1097,9 @@
     {
       if (args.length () == 0)
 	{
-	  tree_evaluator::dbstep_flag = 0;
+	  Vdebugging = false;
+
+          tree_evaluator::reset_debug_state ();
 
 	  octave_throw_interrupt_exception ();
 	}
--- a/src/input.cc	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/input.cc	Fri Jan 22 07:30:44 2010 -0500
@@ -1011,12 +1011,17 @@
   if (nargin == 0 || nargin == 1)
     {
       unwind_protect frame;
+
       frame.add_fcn (octave_call_stack::restore_frame, 
                      octave_call_stack::current_frame ());
 
       // Skip the frame assigned to the keyboard function.
       octave_call_stack::goto_frame_relative (0);
 
+      tree_evaluator::debug_mode = true;
+
+      tree_evaluator::current_frame = octave_call_stack::current_frame ();
+
       do_keyboard (args);
     }
   else
--- a/src/pt-eval.cc	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/pt-eval.cc	Fri Jan 22 07:30:44 2010 -0500
@@ -31,6 +31,7 @@
 #include <fstream>
 #include <typeinfo>
 
+#include "debug.h"
 #include "defun.h"
 #include "error.h"
 #include "gripes.h"
@@ -106,6 +107,14 @@
     tree_continue_command::continuing = 1;
 }
 
+void
+tree_evaluator::reset_debug_state (void)
+{
+  debug_mode = bp_table::have_breakpoints ();
+
+  dbstep_flag = 0;
+}
+
 static inline void
 do_global_init (tree_decl_elt& elt)
 {
--- a/src/pt-eval.h	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/pt-eval.h	Fri Jan 22 07:30:44 2010 -0500
@@ -134,6 +134,8 @@
 
   void visit_do_until_command (tree_do_until_command&);
 
+  static void reset_debug_state (void);
+
   // If > 0, stop executing at the (N-1)th stopping point, counting
   //         from the the current execution point in the current frame.
   //
--- a/src/toplev.cc	Fri Jan 22 12:37:03 2010 +0100
+++ b/src/toplev.cc	Fri Jan 22 07:30:44 2010 -0500
@@ -556,6 +556,9 @@
 
 	  reset_parser ();
 
+          if (symbol_table::at_top_level ())
+            tree_evaluator::reset_debug_state ();
+
 	  // Do this with an unwind-protect cleanup function so that
 	  // the forced variables will be unmarked in the event of an
 	  // interrupt.