# HG changeset patch # User John W. Eaton # Date 1264163444 18000 # Node ID 095a1e670e68d0496d751fcfafcd39419b336c33 # Parent 455759a5fcbe2cd426d3c47623954596d44ee866 make dbstep work with keyboard function diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2010-01-22 John W. Eaton + + * 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 * data.cc (Fnorm): Don't special-case empty matrix. diff --git a/src/debug.cc b/src/debug.cc --- a/src/debug.cc +++ b/src/debug.cc @@ -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 (); } diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -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 diff --git a/src/pt-eval.cc b/src/pt-eval.cc --- a/src/pt-eval.cc +++ b/src/pt-eval.cc @@ -31,6 +31,7 @@ #include #include +#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) { diff --git a/src/pt-eval.h b/src/pt-eval.h --- a/src/pt-eval.h +++ b/src/pt-eval.h @@ -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. // diff --git a/src/toplev.cc b/src/toplev.cc --- a/src/toplev.cc +++ b/src/toplev.cc @@ -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.