+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.
}
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);
if (within_current_scope)
{
+ struct value *val_failed = NULL;
free_valchain (bpt);
/* Evaluate the expression and cut the chain of values
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;
}
}
/* 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",
{
if (b->inserted)
{
- val = remove_breakpoint (b, mark_uninserted);
+ val = remove_breakpoint (b, mark_uninserted, NULL);
if (val != 0)
return val;
}
{
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;
}
{
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
{
if (b->inserted)
{
- val = remove_breakpoint (b, mark_inserted);
+ val = remove_breakpoint (b, mark_inserted, NULL);
if (val != 0)
{
do_cleanups (old_chain);
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;
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. */
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);