diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2006-06-01 13:00:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2006-06-01 13:00:47 +0000 |
commit | ea83716a194b353ee72b2952c0c2a43e190aba5d (patch) | |
tree | fbb8e2bedfa54f14482a76dc7720eed4ceb72e7f | |
parent | 4bee67a81c40b4f6c13560ea3ab50d87f56adcf5 (diff) | |
download | fsf-binutils-gdb-ea83716a194b353ee72b2952c0c2a43e190aba5d.zip fsf-binutils-gdb-ea83716a194b353ee72b2952c0c2a43e190aba5d.tar.gz fsf-binutils-gdb-ea83716a194b353ee72b2952c0c2a43e190aba5d.tar.bz2 |
* 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.csl | 10 | ||||
-rw-r--r-- | gdb/breakpoint.c | 37 |
2 files changed, 30 insertions, 17 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl index d22ce1a..5ccd8ce 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 472d8d0..91eb563 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); |