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.
This commit is contained in:
Jan Kratochvil 2010-06-07 13:38:25 +00:00
parent 1f4e495053
commit 1a2ab13a57
2 changed files with 36 additions and 18 deletions

View file

@ -1,3 +1,18 @@
2010-06-07 Jan Kratochvil <jan.kratochvil@redhat.com>
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.
2010-06-07 Nathan Sidwell <nathan@codesourcery.com>
* README: Make version-agnostic.

View file

@ -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