Mercurial > octave
diff libinterp/parse-tree/pt-eval.cc @ 27200:dc1edf932248
eliminate direct access to call_stack in input functions
* pt-eval.h, pt-eval.cc (tree_evaluator::current_line,
tree_evaluator::caller_user_code_line, tree_evaluator::current_column,
tree_evaluator::caller_user_code, tree_evaluator::goto_frame,
tree_evaluator::caller_user_code_column,
tree_evaluator::restore_frame, tree_evaluator::goto_frame_relative):
New functions.
* input.cc (input_system::keyboard, input_system::get_debug_input,
Fkeyboard): Eliminate direct access to call stack.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Apr 2019 17:32:02 +0000 |
parents | f27002104c5b |
children | bd49997051ef |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc Mon Apr 01 16:58:05 2019 +0000 +++ b/libinterp/parse-tree/pt-eval.cc Mon Apr 01 17:32:02 2019 +0000 @@ -137,16 +137,13 @@ bool silent = tw.quiet_breakpoint_flag (false); - call_stack& cs = m_interpreter.get_call_stack (); - - frame.add_method (cs, &call_stack::restore_frame, - cs.current_frame ()); - - cs.goto_frame (tw.debug_frame ()); - - octave_user_code *caller = cs.current_user_code (); + frame.add_method (tw, &tree_evaluator::restore_frame, + tw.current_call_stack_frame_number ()); + + tw.goto_frame (tw.debug_frame ()); + + octave_user_code *caller = tw.current_user_code (); std::string nm; - int curr_debug_line; if (caller) { @@ -154,11 +151,9 @@ if (nm.empty ()) nm = caller->name (); - - curr_debug_line = cs.current_user_code_line (); } - else - curr_debug_line = cs.current_line (); + + int curr_debug_line = tw.current_line (); std::ostringstream buf; @@ -180,7 +175,7 @@ if (! silent) { - stack_frame *frm = cs.current_user_frame (); + stack_frame *frm = tw.current_user_frame (); frm->display_stopped_in_message (buf); } @@ -277,7 +272,7 @@ // something like "dbup; dbstack"? Will the call to // dbstack use the right frame? If not, how can we // fix this problem? - cs.goto_frame (tw.debug_frame ()); + tw.goto_frame (tw.debug_frame ()); } octave_quit (); @@ -1869,6 +1864,33 @@ return false; } + // Current line in current function. + int tree_evaluator::current_line (void) const + { + return m_call_stack.current_line (); + } + + // Current column in current function. + int tree_evaluator::current_column (void) const + { + return m_call_stack.current_column (); + } + + octave_user_code * tree_evaluator::current_user_code (void) const + { + return m_call_stack.current_user_code (); + } + + bool tree_evaluator::goto_frame (size_t n, bool verbose) + { + return m_call_stack.goto_frame (n, verbose); + } + + void tree_evaluator::restore_frame (size_t n) + { + return m_call_stack.restore_frame (n); + } + std::list<stack_frame *> tree_evaluator::backtrace_frames (octave_idx_type& curr_user_frame) const {