Mercurial > hg > octave-lyh
diff libinterp/parse-tree/pt-eval.cc @ 16354:fb27f1e08297
track line and column info directly in call stack (bug #38556)
* toplev.h, toplev.cc (octave_call_stack::call_stack_elt::line,
octave_call_stack::call_stack_elt::column): New data members.
(octave_call_stack::call_stack_elt::stmt): Delete.
Change all uses.
(octave_call_stack::set_location, octave_call_stack::do_set_location,
(octave_call_stack::set_line, octave_call_stack::do_set_line,
(octave_call_stack::set_column, octave_call_stack::do_set_column):
New functions.
(octave_call_stack::set_statement,
octave_call_stack::do_set_statement):
Delete. Change all callers to use set_location or set_line and
set_column.
* pt-eval.cc (tree_evaluator::visit_if_command): Never call
do_breakpoint here.
(tree_evaluator::visit_if_command_list): Set call stack location for
each if/elseif clause.
(tree_evaluator::visit_switch_command): Don't call do_breakpoint for
individual cases.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 Mar 2013 16:30:00 -0400 |
parents | fb9dffe5fbfb |
children | c6a13c1900fc |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -557,9 +557,6 @@ void tree_evaluator::visit_if_command (tree_if_command& cmd) { - if (debug_mode) - do_breakpoint (cmd.is_breakpoint ()); - tree_if_command_list *lst = cmd.cmd_list (); if (lst) @@ -575,6 +572,9 @@ tree_expression *expr = tic->condition (); + if (statement_context == function || statement_context == script) + octave_call_stack::set_location (tic->line (), tic->column ()); + if (debug_mode && ! tic->is_else_clause ()) do_breakpoint (tic->is_breakpoint ()); @@ -703,7 +703,7 @@ // the state of the program we are debugging. if (! Vdebugging) - octave_call_stack::set_statement (&stmt); + octave_call_stack::set_location (stmt.line (), stmt.column ()); // FIXME -- we need to distinguish functions from scripts to // get this right. @@ -865,9 +865,6 @@ { tree_switch_case *t = *p; - if (debug_mode && ! t->is_default_case ()) - do_breakpoint (t->is_breakpoint ()); - if (t->is_default_case () || t->label_matches (val)) { if (error_state) @@ -946,10 +943,12 @@ frame.protect_var (error_state); error_state = 0; - // We want to preserve the last statement indicator for possible + // We want to preserve the last location info for possible // backtracking. - frame.add_fcn (octave_call_stack::set_statement, - octave_call_stack::current_statement ()); + frame.add_fcn (octave_call_stack::set_line, + octave_call_stack::current_line ()); + frame.add_fcn (octave_call_stack::set_column, + octave_call_stack::current_column ()); // Similarly, if we have seen a return or break statement, allow all // the cleanup code to run before returning or handling the break.