summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-06-01 13:00:47 +0000
committerNathan Sidwell <nathan@codesourcery.com>2006-06-01 13:00:47 +0000
commit99974f2862809845f6c92aae4a78434bb5777ec0 (patch)
treeaea28d4c167f26418afedd62d8c983ce758b4ca0
parent8fc3bae789a51eb030adb0f1b8828afd511cd3c0 (diff)
downloadgdb-99974f2862809845f6c92aae4a78434bb5777ec0.tar.gz
* 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.
-rw-r--r--ChangeLog.csl10
-rw-r--r--gdb/breakpoint.c37
2 files changed, 30 insertions, 17 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index d22ce1ab2d4..5ccd8ced388 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -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.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 472d8d08054..91eb5635ad6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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);