diff src/debug.cc @ 9484:bbe033dcfe13

make dbwhere work when called at keyboard prompt
author John W. Eaton <jwe@octave.org>
date Tue, 04 Aug 2009 15:32:14 -0400 (2009-08-04)
parents 610bf90fce2a
children f22bbc5d56e9
line wrap: on
line diff
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -661,13 +661,21 @@
 
       octave_stdout << name << ":";
 
-      int l = tree_evaluator::debug_line ();
+      unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
+
+      unwind_protect::add_fcn (octave_call_stack::restore_frame, 
+			       octave_call_stack::current_frame ());
+
+      // Skip the frame assigned to the dbwhere function.
+      octave_call_stack::goto_frame_relative (0);
+
+      int l = octave_call_stack::current_line ();
 
       if (l > 0)
 	{
 	  octave_stdout << " line " << l;
 
-	  int c = tree_evaluator::debug_column ();
+	  int c = octave_call_stack::current_column ();
 
 	  if (c > 0)
 	    octave_stdout << ", column " << c;
@@ -684,6 +692,8 @@
 	}
       else
 	octave_stdout << " (unknown line)\n";
+
+      unwind_protect::run_frame (uwp_frame);
     }
   else
     error ("dbwhere: must be inside of a user function to use dbwhere\n");