aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-06-07 13:38:25 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-06-07 13:38:25 +0000
commit1a2ab13a57bdddae90088e334aa792d2af742a3d (patch)
tree61e7fe10a9e201d05012b29202e468bd093032b7 /gdb/breakpoint.c
parent1f4e49505385a998c734d2349a201ba03d7aee65 (diff)
downloadgdb-1a2ab13a57bdddae90088e334aa792d2af742a3d.zip
gdb-1a2ab13a57bdddae90088e334aa792d2af742a3d.tar.gz
gdb-1a2ab13a57bdddae90088e334aa792d2af742a3d.tar.bz2
gdb/
Clear stale specific bp_location from former whole breakpoint. * breakpoint.c (delete_breakpoint): Move the stale referencing clear code ... (free_bp_location): ... here. Rename there the called function to bpstat_remove_bp_location_callback. (bpstat_remove_breakpoint_callback): Rename to ... (bpstat_remove_bp_location_callback): ... here, change DATA resolution to struct bp_location. Change the called function to bpstat_remove_bp_location. Create new declaration for the function. (bpstat_remove_breakpoint): Rename to ... (bpstat_remove_bp_location): ..., change the parameter to loc, adjust code for the new parameter type.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1fc155a..41fb8b8 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -206,6 +206,9 @@ static void update_global_location_list (int);
static void update_global_location_list_nothrow (int);
+static int bpstat_remove_bp_location_callback (struct thread_info *th,
+ void *data);
+
static int is_hardware_watchpoint (const struct breakpoint *bpt);
static int is_watchpoint (const struct breakpoint *bpt);
@@ -5371,6 +5374,18 @@ allocate_bp_location (struct breakpoint *bpt)
static void free_bp_location (struct bp_location *loc)
{
+ /* Be sure no bpstat's are pointing at it after it's been freed. */
+ /* FIXME, how can we find all bpstat's?
+ We just check stop_bpstat for now. Note that we cannot just
+ remove bpstats pointing at bpt from the stop_bpstat list
+ entirely, as breakpoint commands are associated with the bpstat;
+ if we remove it here, then the later call to
+ bpstat_do_actions (&stop_bpstat);
+ in event-top.c won't do anything, and temporary breakpoints
+ with commands won't work. */
+
+ iterate_over_threads (bpstat_remove_bp_location_callback, loc);
+
if (loc->cond)
xfree (loc->cond);
@@ -9219,14 +9234,14 @@ update_global_location_list_nothrow (int inserting)
update_global_location_list (inserting);
}
-/* Clear BPT from a BPS. */
+/* Clear LOC from a BPS. */
static void
-bpstat_remove_breakpoint (bpstat bps, struct breakpoint *bpt)
+bpstat_remove_bp_location (bpstat bps, struct bp_location *loc)
{
bpstat bs;
for (bs = bps; bs; bs = bs->next)
- if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
+ if (bs->breakpoint_at == loc)
{
bs->breakpoint_at = NULL;
bs->old_val = NULL;
@@ -9236,11 +9251,11 @@ bpstat_remove_breakpoint (bpstat bps, struct breakpoint *bpt)
/* Callback for iterate_over_threads. */
static int
-bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
+bpstat_remove_bp_location_callback (struct thread_info *th, void *data)
{
- struct breakpoint *bpt = data;
+ struct bp_location *loc = data;
- bpstat_remove_breakpoint (th->stop_bpstat, bpt);
+ bpstat_remove_bp_location (th->stop_bpstat, loc);
return 0;
}
@@ -9303,18 +9318,6 @@ delete_breakpoint (struct breakpoint *bpt)
xfree (bpt->exec_pathname);
clean_up_filters (&bpt->syscalls_to_be_caught);
- /* Be sure no bpstat's are pointing at it after it's been freed. */
- /* FIXME, how can we find all bpstat's?
- We just check stop_bpstat for now. Note that we cannot just
- remove bpstats pointing at bpt from the stop_bpstat list
- entirely, as breakpoint commands are associated with the bpstat;
- if we remove it here, then the later call to
- bpstat_do_actions (&stop_bpstat);
- in event-top.c won't do anything, and temporary breakpoints
- with commands won't work. */
-
- iterate_over_threads (bpstat_remove_breakpoint_callback, bpt);
-
/* Now that breakpoint is removed from breakpoint
list, update the global location list. This
will remove locations that used to belong to