changeset 27540:6971bc1a2f92

deprecate unecessary global variable Vtrack_line_num * input.h (Vtrack_line_num): Tag as deprecated. Remove all uses. * pt-eval.cc (tree_evaluator::visit_statement): Always set stack location if statement context is script or function.
author John W. Eaton <jwe@octave.org>
date Mon, 21 Oct 2019 16:08:32 -0400
parents 207e0bc53cdd
children 5e1f2f1a7fcf
files libinterp/corefcn/debug.cc libinterp/corefcn/input.h libinterp/parse-tree/pt-eval.cc
diffstat 3 files changed, 2 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/debug.cc	Mon Oct 21 19:55:41 2019 -0700
+++ b/libinterp/corefcn/debug.cc	Mon Oct 21 16:08:32 2019 -0400
@@ -1112,8 +1112,6 @@
 
   if (n != 0)
     {
-      Vtrack_line_num = true;
-
       tw.set_dbstep_flag (n);
 
       // If we set the dbstep flag, we also need to reset debug_mode.
@@ -1141,8 +1139,6 @@
   if (args.length () != 0)
     print_usage ();
 
-  Vtrack_line_num = true;
-
   tw.dbcont ();
 
   return ovl ();
--- a/libinterp/corefcn/input.h	Mon Oct 21 19:55:41 2019 -0700
+++ b/libinterp/corefcn/input.h	Mon Oct 21 16:08:32 2019 -0400
@@ -44,7 +44,7 @@
 // the next user prompt.
 extern OCTINTERP_API bool Vdrawnow_requested;
 
-// TRUE if we are not executing a command direct from debug> prompt.
+OCTAVE_DEPRECATED (6, "'Vtrack_line_num' is an obsolete internal variable; any uses should be removed")
 extern OCTINTERP_API bool Vtrack_line_num;
 
 extern octave::sys::time Vlast_prompt_time;
--- a/libinterp/parse-tree/pt-eval.cc	Mon Oct 21 19:55:41 2019 -0700
+++ b/libinterp/parse-tree/pt-eval.cc	Mon Oct 21 16:08:32 2019 -0400
@@ -274,8 +274,6 @@
 
         try
           {
-            Vtrack_line_num = false;
-
             debug_parser.reset ();
 
 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
@@ -820,8 +818,6 @@
     // tree_print_code tpc (octave_stdout);
     // stmt.accept (tpc);
 
-    Vtrack_line_num = false;
-
     debugger *dbgr = new debugger (m_interpreter, m_debugger_stack.size ());
 
     m_debugger_stack.push (dbgr);
@@ -2301,10 +2297,6 @@
 
     frame.add_method (m_call_stack, &call_stack::pop);
 
-    // Update line number even if debugging.
-    frame.protect_var (Vtrack_line_num);
-    Vtrack_line_num = true;
-
     frame.protect_var (m_statement_context);
     m_statement_context = SC_SCRIPT;
 
@@ -2377,10 +2369,6 @@
 
     m_call_stack.push (&user_function, &frame, closure_frames);
 
-    frame.protect_var (Vtrack_line_num);
-    // update source line numbers, even if debugging
-    Vtrack_line_num = true;
-
     frame.add_method (m_call_stack, &call_stack::pop);
 
     bind_auto_fcn_vars (xargs.name_tags (), args.length (),
@@ -2711,13 +2699,7 @@
       {
         if (m_statement_context == SC_FUNCTION
             || m_statement_context == SC_SCRIPT)
-          {
-            // Skip commands issued at a debug> prompt to avoid disturbing
-            // the state of the program we are debugging.
-
-            if (Vtrack_line_num)
-              m_call_stack.set_location (stmt.line (), stmt.column ());
-          }
+          m_call_stack.set_location (stmt.line (), stmt.column ());
 
         try
           {