Mercurial > octave-libtiff
changeset 29527:c7569a4224bd
undo previous change; reset parser in server loop
* pt-eval.cc (tree_evaluator::server_loop): Reset parser after each
call to m_interpreter.recover_from_exception instead of at the top of
the loop.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Apr 2021 08:06:05 -0400 |
parents | b65824235c7f |
children | bb64fc1ef1ab |
files | libinterp/corefcn/interpreter.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h |
diffstat | 3 files changed, 14 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc Tue Apr 13 06:25:20 2021 -0400 +++ b/libinterp/corefcn/interpreter.cc Tue Apr 13 08:06:05 2021 -0400 @@ -1983,8 +1983,6 @@ octave_signal_caught = 0; octave_restore_signal_mask (); catch_interrupts (); - - m_evaluator.reset (); } void interpreter::mark_for_deletion (const std::string& file)
--- a/libinterp/parse-tree/pt-eval.cc Tue Apr 13 06:25:20 2021 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Tue Apr 13 08:06:05 2021 -0400 @@ -779,6 +779,12 @@ std::shared_ptr<push_parser> parser (new push_parser (m_interpreter)); unwind_protect_var<std::shared_ptr<push_parser>> upv2 (m_parser, parser); + // FIXME: We are currently resetting the parser after every call to + // recover_from_exception. This action should probably be handled + // in a more consistent way, but resetting the parser in every call + // to interpreter::recover_from_exception appears to cause + // segfaults in the test suite. + do { try @@ -801,6 +807,7 @@ { octave_interrupt_state = 1; m_interpreter.recover_from_exception (); + m_parser->reset (); // Required newline when the user does Ctrl+C at the prompt. if (m_interpreter.interactive ()) @@ -809,6 +816,7 @@ catch (const index_exception& e) { m_interpreter.recover_from_exception (); + m_parser->reset (); std::cerr << "error: unhandled index exception: " << e.message () << " -- trying to return to prompt" @@ -822,7 +830,10 @@ es.display_exception (ee); if (m_interpreter.interactive ()) - m_interpreter.recover_from_exception (); + { + m_interpreter.recover_from_exception (); + m_parser->reset (); + } else { // We should exit with a nonzero status. @@ -834,6 +845,7 @@ { octave_interrupt_state = 1; m_interpreter.recover_from_exception (); + m_parser->reset (); } catch (const exit_exception& xe) { @@ -843,6 +855,7 @@ catch (const std::bad_alloc&) { m_interpreter.recover_from_exception (); + m_parser->reset (); std::cerr << "error: out of memory -- trying to return to prompt" << std::endl; @@ -1208,12 +1221,6 @@ } void - tree_evaluator::reset (void) - { - m_parser->reset (); - } - - void tree_evaluator::reset_debug_state (void) { m_debug_mode = (m_bp_table.have_breakpoints ()
--- a/libinterp/parse-tree/pt-eval.h Tue Apr 13 06:25:20 2021 -0400 +++ b/libinterp/parse-tree/pt-eval.h Tue Apr 13 08:06:05 2021 -0400 @@ -308,10 +308,6 @@ bool statement_printing_enabled (void); - // Currently called from interpreter::recover_from_exception to - // reset parser state. - void reset (void); - void reset_debug_state (void); void reset_debug_state (bool mode);