This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 1/3] Clear stale specific locs, not whole bpts [rediff]


On Monday 17 May 2010 22:22:43, Jan Kratochvil wrote:
>  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);
> +

I think this isn't the best place for this, considering moribund
breakpoint locations --- it's too late.  When you delete a
breakpoint in non-stop/always-inserted modes, you'll delete
the breakpoint, but deleting the bp_location itself is deferred.
This means that in that case, the thread's bpstat chains may still
contain references to bp_locations that are now in the moribund list
(those will be still valid objects, not xfree'd yet), but their owner
breakpoint is gone, meaning bpstat walks can still dereference those
now invalid bp_location->owner pointers.

Instead, can you move this to within in the `if (!found_object)' branch
of update_global_location_list?  That is, move it close to where we
detected we had unlinked the bp_location from the global
location list?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]