Mercurial > octave
changeset 27240:336c640c481b
make "dbquit all" work and fix dbquit compatibility (bug #56616)
* debug.cc (Fdbquit): Accept "all" argument. Don't throw exception,
just set debugger flags.
* pt-eval.cc (tree_evaluator::do_breakpoint): Don't check current
debugger for exit or abort flags.
(debugger::repl): Throw interrupt exception if m_abort_debug_repl is
true.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 12 Jul 2019 10:41:47 -0400 |
parents | bee80e27dcc5 |
children | 733431da9742 |
files | libinterp/corefcn/debug.cc libinterp/parse-tree/pt-eval.cc |
diffstat | 2 files changed, 24 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/debug.cc Thu Jul 11 20:16:58 2019 -0700 +++ b/libinterp/corefcn/debug.cc Fri Jul 12 10:41:47 2019 -0400 @@ -1151,8 +1151,10 @@ DEFMETHOD (dbquit, interp, args, , doc: /* -*- texinfo -*- @deftypefn {} {} dbquit -Quit debugging mode immediately without further code execution and return to -the Octave prompt. +@deftypefnx {} {} dbquit all +Quit debugging mode immediately without further code execution. With no +arguments, exit the current debugging level. With argument @code{all}, +exit all debugging levels and return to the Octave prompt. @seealso{dbcont, dbstep} @end deftypefn */) { @@ -1161,12 +1163,25 @@ if (! tw.in_debug_repl ()) error ("dbquit: can only be called in debug mode"); - if (args.length () != 0) + int nargin = args.length (); + + if (nargin > 1) print_usage (); - tw.debug_mode (false); + if (nargin == 1) + { + std::string arg + = args(0).xstring_value ("dbquit: input argument must be a string"); - throw octave::interrupt_exception (); + if (arg == "all") + tw.abort_debug_repl (true); + else + error ("dbquit: unrecognized argument '%s'", arg.c_str ()); + } + else + tw.exit_debug_repl (true); + + tw.debug_mode (false); return ovl (); }
--- a/libinterp/parse-tree/pt-eval.cc Thu Jul 11 20:16:58 2019 -0700 +++ b/libinterp/parse-tree/pt-eval.cc Fri Jul 12 10:41:47 2019 -0400 @@ -239,9 +239,12 @@ while (m_in_debug_repl) { - if (m_exit_debug_repl || m_abort_debug_repl || tw.dbstep_flag ()) + if (m_exit_debug_repl || tw.dbstep_flag ()) break; + if (m_abort_debug_repl) + throw interrupt_exception (); + try { Vtrack_line_num = false; @@ -4405,25 +4408,6 @@ { bool break_on_this_statement = false; - debugger *curr_debugger - = (m_debugger_stack.empty () ? nullptr : m_debugger_stack.top ()); - - if (curr_debugger) - { - if (curr_debugger->exit_debug_repl ()) - { - // This action corresponds to dbcont. - reset_debug_state (); - } - else if (curr_debugger->abort_debug_repl ()) - { - // This action corresponds to dbquit. - debug_mode (false); - - throw interrupt_exception (); - } - } - if (is_breakpoint) break_on_this_statement = true; else if (m_dbstep_flag > 0)