changeset 10838:960065af9f0f

pt-bp.cc: more debugger fixes
author John W. Eaton <jwe@octave.org>
date Fri, 30 Jul 2010 17:19:28 -0400
parents 6ea0cf31667d
children 65bc065bec95
files src/ChangeLog src/pt-bp.cc
diffstat 2 files changed, 31 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jul 30 10:43:54 2010 -0700
+++ b/src/ChangeLog	Fri Jul 30 17:19:28 2010 -0400
@@ -1,3 +1,13 @@
+2010-07-30  John W. Eaton  <jwe@octave.org>
+
+	* pt-bp.cc (tree_breakpoint::take_action): Only call
+	delete_breakpoint if is_breakpoint returns true.
+	(tree_breakpoint::visit_statement): If statement is command,
+	accept it, otherwise, maybe take action on the statement.
+	(tree_breakpoint::visit_no_op_command): Handle breakpoints at
+	end of function.
+	Addresses more problems found with bug #30490.
+
 2010-07-30  Rik <octave@nomad.inbox5.com>
 
 	* Makefile.am: add .DOCSTRINGS to the DISTCLEANFILES list
--- a/src/pt-bp.cc	Fri Jul 30 10:43:54 2010 -0700
+++ b/src/pt-bp.cc	Fri Jul 30 17:19:28 2010 -0400
@@ -274,8 +274,10 @@
 }
 
 void
-tree_breakpoint::visit_no_op_command (tree_no_op_command&)
+tree_breakpoint::visit_no_op_command (tree_no_op_command& cmd)
 {
+  if (cmd.is_end_of_fcn_or_script () && cmd.line () >= line)
+    take_action (cmd);
 }
 
 void
@@ -336,19 +338,17 @@
 void
 tree_breakpoint::visit_statement (tree_statement& stmt)
 {
-  if (stmt.line () >= line)
-    {
-      take_action (stmt);
-    }
-  else if (stmt.is_command ())
+  if (stmt.is_command ())
     {
       tree_command *cmd = stmt.command ();
 
       cmd->accept (*this);
     }
-
-  // There is no need to do anything for expressions because they
-  // can't contain additional lists of statements.
+  else
+    {
+      if (stmt.line () >= line)
+        take_action (stmt);
+    }
 }
 
 void
@@ -457,16 +457,16 @@
     }
   else if (act == clear)
     {
-      tr.delete_breakpoint ();
-      found = true;
+      if (tr.is_breakpoint ())
+        {
+          tr.delete_breakpoint ();
+          found = true;
+        }
     }
   else if (act == list)
     {
       if (tr.is_breakpoint ())
-        {
-          bp_list.append (octave_value (tr.line ()));
-          line = tr.line () + 1;
-        }
+        bp_list.append (octave_value (tr.line ()));
     }
   else
     panic_impossible ();
@@ -485,16 +485,16 @@
     }
   else if (act == clear)
     {
-      stmt.delete_breakpoint ();
-      found = true;
+      if (stmt.is_breakpoint ())
+        {
+          stmt.delete_breakpoint ();
+          found = true;
+        }
     }
   else if (act == list)
     {
       if (stmt.is_breakpoint ())
-        {
-          bp_list.append (octave_value (lineno));
-          line = lineno + 1;
-        }
+        bp_list.append (octave_value (lineno));
     }
   else
     panic_impossible ();