* breakpoint.c (update_watchpoint): Move code to change
authorThiago Jung Bauermann <bauerman@br.ibm.com>
Tue, 3 May 2011 05:02:54 +0000 (05:02 +0000)
committerThiago Jung Bauermann <bauerman@br.ibm.com>
Tue, 3 May 2011 05:02:54 +0000 (05:02 +0000)
the enable state of breakpoint from here ...
(do_enable_breakpoint): ... to here.

gdb/ChangeLog
gdb/breakpoint.c

index 0828d17b8fc4d258ceacd095ee108bbde70473e6..32c6491442af738b0e07ee84ae692aef8d4c5b6d 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-03  Thiago Jung Bauermann  <bauerman@br.ibm.com>
+
+       * breakpoint.c (update_watchpoint): Move code to change
+       the enable state of breakpoint from here ...
+       (do_enable_breakpoint): ... to here.
+
 2011-04-26  Andrew Gontarek  <andrewg@cray.com>
 
        * valprint.c (val_print_array_elements): Fixed poor performance
index b9d76c7cde90cd98d4ca3751d3c121e53830f306..e265135fdd900368a44b3f986992b04bbb2b413e 100644 (file)
@@ -1416,7 +1416,6 @@ update_watchpoint (struct breakpoint *b, int reparse)
          if (reg_cnt)
            {
              int i, target_resources_ok, other_type_used;
-             enum enable_state orig_enable_state;
 
              /* We need to determine how many resources are already
                 used for all other hardware watchpoints plus this one
@@ -1427,17 +1426,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
                 watchpoint.  */
              b->type = bp_hardware_watchpoint;
 
-             /* hw_watchpoint_used_count ignores disabled watchpoints,
-                and b might be disabled if we're being called from
-                do_enable_breakpoint.  */
-             orig_enable_state = b->enable_state;
-             b->enable_state = bp_enabled;
-
              i = hw_watchpoint_used_count (bp_hardware_watchpoint,
                                            &other_type_used);
 
-             b->enable_state = orig_enable_state;
-
              target_resources_ok = target_can_use_hardware_watchpoint
                    (bp_hardware_watchpoint, i, other_type_used);
              if (target_resources_ok <= 0)
@@ -11477,14 +11468,18 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
 
   if (is_watchpoint (bpt))
     {
+      enum enable_state orig_enable_state;
       struct gdb_exception e;
 
       TRY_CATCH (e, RETURN_MASK_ALL)
        {
+         orig_enable_state = bpt->enable_state;
+         bpt->enable_state = bp_enabled;
          update_watchpoint (bpt, 1 /* reparse */);
        }
       if (e.reason < 0)
        {
+         bpt->enable_state = orig_enable_state;
          exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
                             bpt->number);
          return;