This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH v4 2/3] Forget watchpoint locations when inferior exits or is killed/detached
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 1 Jul 2016 11:49:03 +0100
- Subject: Re: [PATCH v4 2/3] Forget watchpoint locations when inferior exits or is killed/detached
- Authentication-results: sourceware.org; auth=none
- References: <1466119968-15171-1-git-send-email-palves at redhat dot com> <1466119968-15171-3-git-send-email-palves at redhat dot com> <86oa70rpv7 dot fsf at gmail dot com> <29fd882b-a60e-ed27-ff15-2399c9551668 at redhat dot com>
On 06/24/2016 08:10 PM, Pedro Alves wrote:
> On 06/17/2016 12:55 PM, Yao Qi wrote:
>> Pedro Alves <firstname.lastname@example.org> writes:
>>> + /* Get rid of existing locations, which are no longer
>>> + valid. New ones will be created in
>>> + update_watchpoint, when the inferior is
>>> + restarted. */
>>> + b->loc = NULL;
>> Use decref_bp_location or is it intended?
> It's intended. The b->loc chain doesn't count for incr/decref.
> It really holds weak references. The strong references are either
> in the global location chain or the bpstat chains. So the next time
> update_global_location_list is called, locations that are found
> to not be referenced by any breakpoint are garbage collected then,
> via decref_bp_location.
> See how update_breakpoint_locations simply hoists old locations
> out of the breakpoint, but doesn't decref them. [Used to clearer
> before c2f4122d5cc2 ("Limit breakpoint re-set to the current
> program space") though].
I've pushed this with the comment updated to say:
/* Get rid of existing locations, which are no longer
valid. New ones will be created in
update_watchpoint, when the inferior is restarted.
The next update_global_location_list call will
garbage collect them. */