diff --git a/libinterp/parse-tree/pt-eval.cc b/libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -65,6 +65,7 @@ #include "pt-anon-scopes.h" #include "pt-eval.h" #include "pt-tm-const.h" +#include "sighandlers.h" #include "stack-frame.h" #include "symtab.h" #include "unwind-prot.h" @@ -3786,10 +3787,28 @@ Example: catch (const interrupt_exception&) { // If we are debugging, then continue with next statement. + // If debug_on_interrupt is true, enter the debugger. // Otherwise, jump out of here. if (m_debug_mode) m_interpreter.recover_from_exception (); + else if ((m_interpreter.interactive () + || application::forced_interactive ()) + && Vdebug_on_interrupt) + { + m_interpreter.recover_from_exception (); + + enter_debugger (); + + // FIXME: With the way we set interrupt state and then + // throw an interrupt_exception from octave_quit, is it + // OK to continue execution here or is it possible that + // we may have skipped something important? I don't + // think it is possible to enter the debugger anywhere + // octave_quit is called, is it? If it were, then I + // think we could be sure that continuing execution + // after an interrupt would be OK. + } else throw; }