]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb/remote.c (remote_insert_watchpoint): Return -1, rather than gdb-csl-arm-2006q1-6 gdb-csl-sourcerygxx-4_1-6
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 5 Jun 2006 17:31:50 +0000 (17:31 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Mon, 5 Jun 2006 17:31:50 +0000 (17:31 +0000)
fatal error if packet is disabled.
(remote_remove_watchpoint, remote_insert_hw_breakpoint,
remote_remove_hw_breakpoint): Likewise.
Revert my 2006-06-01  Nathan Sidwell  <nathan@codesourcery.com>
change to breakpoint.c

ChangeLog.csl
gdb/breakpoint.c
gdb/remote.c

index 4272861191e8cfa654064236075cd2a99ca77164..c7dfa9c557b1fd426eaf12eb6cf79e12478a587c 100644 (file)
@@ -1,5 +1,12 @@
 2006-06-05  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * gdb/remote.c (remote_insert_watchpoint): Return -1, rather than
+       fatal error if packet is disabled.
+       (remote_remove_watchpoint, remote_insert_hw_breakpoint,
+       remote_remove_hw_breakpoint): Likewise.
+       Revert my 2006-06-01  Nathan Sidwell  <nathan@codesourcery.com>
+       change to breakpoint.c
+
        * gdb/testsuite/gdb.asm/m68k.inc (gdbasm_call): Use jsr.
        * gdb/testsuite/gdb.base/fileio.c (stop): New.  Call it everywhere
        the debugger should stop.
index 91eb5635ad6e46357bd5a5edd238543ac48a3ba6..472d8d080547e0d4804b90498c44147aaad85396 100644 (file)
@@ -129,8 +129,7 @@ typedef enum
   }
 insertion_state_t;
 
-static int remove_breakpoint (struct bp_location *, insertion_state_t,
-                             struct value *);
+static int remove_breakpoint (struct bp_location *, insertion_state_t);
 
 static enum print_stop_action print_it_typical (bpstat);
 
@@ -949,7 +948,6 @@ 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
@@ -997,8 +995,13 @@ insert_bp_location (struct bp_location *bpt,
                      val = target_insert_watchpoint (addr, len, type);
                      if (val == -1)
                        {
-                         val_failed = v;
-                         break;
+                         /* 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 = 0;
                    }
@@ -1006,10 +1009,9 @@ insert_bp_location (struct bp_location *bpt,
            }
          /* Failure to insert a watchpoint on any memory value in the
             value chain brings us here.  */
-         if (val_failed)
+         if (!bpt->inserted)
            {
-             remove_breakpoint (bpt, mark_uninserted, val_failed);
-             bpt->inserted = 0;
+             remove_breakpoint (bpt, mark_uninserted);
              *hw_breakpoint_error = 1;
              fprintf_unfiltered (tmp_error_stream,
                                  "Could not insert hardware watchpoint %d.\n", 
@@ -1197,7 +1199,7 @@ remove_breakpoints (void)
   {
     if (b->inserted)
       {
-       val = remove_breakpoint (b, mark_uninserted, NULL);
+       val = remove_breakpoint (b, mark_uninserted);
        if (val != 0)
          return val;
       }
@@ -1215,7 +1217,7 @@ remove_hw_watchpoints (void)
   {
     if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint)
       {
-       val = remove_breakpoint (b, mark_uninserted, NULL);
+       val = remove_breakpoint (b, mark_uninserted);
        if (val != 0)
          return val;
       }
@@ -1236,7 +1238,7 @@ reattach_breakpoints (int pid)
   {
     if (b->inserted)
       {
-       remove_breakpoint (b, mark_inserted, NULL);
+       remove_breakpoint (b, mark_inserted);
        if (b->loc_type == bp_loc_hardware_breakpoint)
          val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
        else
@@ -1404,7 +1406,7 @@ detach_breakpoints (int pid)
   {
     if (b->inserted)
       {
-       val = remove_breakpoint (b, mark_inserted, NULL);
+       val = remove_breakpoint (b, mark_inserted);
        if (val != 0)
          {
            do_cleanups (old_chain);
@@ -1416,13 +1418,8 @@ 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,
-                  struct value *val_failed)
+remove_breakpoint (struct bp_location *b, insertion_state_t is)
 {
   int val;
 
@@ -1506,7 +1503,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 != val_failed; v = value_next (v))
+      for (v = b->owner->val_chain; v; v = value_next (v))
        {
          /* For each memory reference remove the watchpoint
             at that address.  */
@@ -6778,7 +6775,7 @@ delete_breakpoint (struct breakpoint *bpt)
   breakpoint_delete_event (bpt->number);
 
   if (bpt->loc->inserted)
-    remove_breakpoint (bpt->loc, mark_inserted, NULL);
+    remove_breakpoint (bpt->loc, mark_inserted);
 
   free_valchain (bpt->loc);
 
index 4602635f26281d456725d0731b064380e7205b66..599bb2189ba65a85dd42b5249005993d51ebf172 100644 (file)
@@ -4670,9 +4670,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type)
   enum Z_packet_type packet = watchpoint_to_Z_packet (type);
 
   if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
-    error (_("Can't set hardware watchpoints without the '%s' (%s) packet."),
-          remote_protocol_packets[PACKET_Z0 + packet].name,
-          remote_protocol_packets[PACKET_Z0 + packet].title);
+    return -1;
 
   sprintf (buf, "Z%x,", packet);
   p = strchr (buf, '\0');
@@ -4705,10 +4703,8 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type)
   enum Z_packet_type packet = watchpoint_to_Z_packet (type);
 
   if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
-    error (_("Can't clear hardware watchpoints without the '%s' (%s) packet."),
-          remote_protocol_packets[PACKET_Z0 + packet].name,
-          remote_protocol_packets[PACKET_Z0 + packet].title);
-
+    return -1;
+  
   sprintf (buf, "z%x,", packet);
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
@@ -4796,10 +4792,8 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   BREAKPOINT_FROM_PC (&addr, &len);
 
   if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
-    error (_("Can't set hardware breakpoint without the '%s' (%s) packet."),
-          remote_protocol_packets[PACKET_Z1].name,
-          remote_protocol_packets[PACKET_Z1].title);
-
+    return -1;
+  
   *(p++) = 'Z';
   *(p++) = '1';
   *(p++) = ',';
@@ -4838,9 +4832,7 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   BREAKPOINT_FROM_PC (&addr, &len);
 
   if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
-    error (_("Can't clear hardware breakpoint without the '%s' (%s) packet."),
-          remote_protocol_packets[PACKET_Z1].name,
-          remote_protocol_packets[PACKET_Z1].title);
+    return -1;
 
   *(p++) = 'z';
   *(p++) = '1';