]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb/breakpoint.c (insert_bp_location): Remember the failing
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 1 Jun 2006 13:00:47 +0000 (13:00 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Thu, 1 Jun 2006 13:00:47 +0000 (13:00 +0000)
watchpoint address and pass to remove_breakpoint.
(remove_breakpoints, remove_hw_watchpoints, reattach_breakpoints,
detach_breakpoints): Adjust remove_breakpoint call.
(remove_breakpoint): Add VAL_FAILED parameter.  Stop removing
watchpoint addresses when it is reached.
(delete_breakpoint): Adjust remove_breakpoint call.

ChangeLog.csl
gdb/breakpoint.c

index d22ce1ab2d43c9fc2e7bfea7be76b22b04cb3b7c..5ccd8ced388de61065cc5e37634000b00ae17d11 100644 (file)
@@ -1,3 +1,13 @@
+2006-06-01  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * gdb/breakpoint.c (insert_bp_location): Remember the failing
+       watchpoint address and pass to remove_breakpoint.
+       (remove_breakpoints, remove_hw_watchpoints, reattach_breakpoints,
+       detach_breakpoints): Adjust remove_breakpoint call.
+       (remove_breakpoint): Add VAL_FAILED parameter.  Stop removing
+       watchpoint addresses when it is reached.
+       (delete_breakpoint): Adjust remove_breakpoint call.
+
 2006-05-24  Nathan Sidwell  <nathan@codesourcery.com>
 
        * gdb/remote-fileio.c (remote_fileio_reset): New.
index 472d8d080547e0d4804b90498c44147aaad85396..91eb5635ad6e46357bd5a5edd238543ac48a3ba6 100644 (file)
@@ -129,7 +129,8 @@ typedef enum
   }
 insertion_state_t;
 
-static int remove_breakpoint (struct bp_location *, insertion_state_t);
+static int remove_breakpoint (struct bp_location *, insertion_state_t,
+                             struct value *);
 
 static enum print_stop_action print_it_typical (bpstat);
 
@@ -948,6 +949,7 @@ insert_bp_location (struct bp_location *bpt,
 
       if (within_current_scope)
        {
+         struct value *val_failed = NULL;
          free_valchain (bpt);
 
          /* Evaluate the expression and cut the chain of values
@@ -995,13 +997,8 @@ insert_bp_location (struct bp_location *bpt,
                      val = target_insert_watchpoint (addr, len, type);
                      if (val == -1)
                        {
-                         /* Don't exit the loop, try to insert
-                            every value on the value chain.  That's
-                            because we will be removing all the
-                            watches below, and removing a
-                            watchpoint we didn't insert could have
-                            adverse effects.  */
-                         bpt->inserted = 0;
+                         val_failed = v;
+                         break;
                        }
                      val = 0;
                    }
@@ -1009,9 +1006,10 @@ insert_bp_location (struct bp_location *bpt,
            }
          /* Failure to insert a watchpoint on any memory value in the
             value chain brings us here.  */
-         if (!bpt->inserted)
+         if (val_failed)
            {
-             remove_breakpoint (bpt, mark_uninserted);
+             remove_breakpoint (bpt, mark_uninserted, val_failed);
+             bpt->inserted = 0;
              *hw_breakpoint_error = 1;
              fprintf_unfiltered (tmp_error_stream,
                                  "Could not insert hardware watchpoint %d.\n", 
@@ -1199,7 +1197,7 @@ remove_breakpoints (void)
   {
     if (b->inserted)
       {
-       val = remove_breakpoint (b, mark_uninserted);
+       val = remove_breakpoint (b, mark_uninserted, NULL);
        if (val != 0)
          return val;
       }
@@ -1217,7 +1215,7 @@ remove_hw_watchpoints (void)
   {
     if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint)
       {
-       val = remove_breakpoint (b, mark_uninserted);
+       val = remove_breakpoint (b, mark_uninserted, NULL);
        if (val != 0)
          return val;
       }
@@ -1238,7 +1236,7 @@ reattach_breakpoints (int pid)
   {
     if (b->inserted)
       {
-       remove_breakpoint (b, mark_inserted);
+       remove_breakpoint (b, mark_inserted, NULL);
        if (b->loc_type == bp_loc_hardware_breakpoint)
          val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
        else
@@ -1406,7 +1404,7 @@ detach_breakpoints (int pid)
   {
     if (b->inserted)
       {
-       val = remove_breakpoint (b, mark_inserted);
+       val = remove_breakpoint (b, mark_inserted, NULL);
        if (val != 0)
          {
            do_cleanups (old_chain);
@@ -1418,8 +1416,13 @@ detach_breakpoints (int pid)
   return 0;
 }
 
+/* Remove the breakpoints for B.  FAILED_VAL, if non-null is the value
+   in the bpt->owner->val_chain that failed to be inserted.  We stop
+   at that point.  */
+
 static int
-remove_breakpoint (struct bp_location *b, insertion_state_t is)
+remove_breakpoint (struct bp_location *b, insertion_state_t is,
+                  struct value *val_failed)
 {
   int val;
 
@@ -1503,7 +1506,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
 
       b->inserted = (is == mark_inserted);
       /* Walk down the saved value chain.  */
-      for (v = b->owner->val_chain; v; v = value_next (v))
+      for (v = b->owner->val_chain; v != val_failed; v = value_next (v))
        {
          /* For each memory reference remove the watchpoint
             at that address.  */
@@ -6775,7 +6778,7 @@ delete_breakpoint (struct breakpoint *bpt)
   breakpoint_delete_event (bpt->number);
 
   if (bpt->loc->inserted)
-    remove_breakpoint (bpt->loc, mark_inserted);
+    remove_breakpoint (bpt->loc, mark_inserted, NULL);
 
   free_valchain (bpt->loc);