diff src/pt-bp.cc @ 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 e5c752231985
children fd0a3ac60b0e
line wrap: on
line diff
--- a/src/pt-bp.cc
+++ b/src/pt-bp.cc
@@ -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 ();