# HG changeset patch # User John W. Eaton # Date 1562250477 14400 # Node ID f5b9670604425f6bfda76c7a8e61798559f0e609 # Parent 0fe52ad36b2409efda5223425ee4fde3611d9e33 ensure debuger_stack is popped when exiting a debug level (bug #56150) * debug.cc (Fdbquit): Set debug_mode and throw interrupt exception. * pt-eval.cc (tree_evaluator::enter_debugger): Add action to unwind_protect frame to pop and delete debugger object from m_debugger_stack. diff -r 0fe52ad36b24 -r f5b967060442 libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Mon Jul 01 18:05:46 2019 -0400 +++ b/libinterp/corefcn/debug.cc Thu Jul 04 10:27:57 2019 -0400 @@ -1164,7 +1164,9 @@ if (args.length () != 0) print_usage (); - tw.abort_debug_repl (true); + tw.debug_mode (false); + + throw octave::interrupt_exception (); return ovl (); } diff -r 0fe52ad36b24 -r f5b967060442 libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Mon Jul 01 18:05:46 2019 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Thu Jul 04 10:27:57 2019 -0400 @@ -1126,6 +1126,12 @@ m_debugger_stack.push (dbgr); + frame.add ([this] (void) + { + delete m_debugger_stack.top (); + m_debugger_stack.pop (); + }); + dbgr->repl (prompt); } @@ -4412,19 +4418,11 @@ if (curr_debugger->exit_debug_repl ()) { // This action corresponds to dbcont. - - m_debugger_stack.pop (); - delete curr_debugger; - reset_debug_state (); } else if (curr_debugger->abort_debug_repl ()) { // This action corresponds to dbquit. - - m_debugger_stack.pop (); - delete curr_debugger; - debug_mode (false); throw interrupt_exception ();