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 v4 2/3] Forget watchpoint locations when inferior exits or is killed/detached


On 06/24/2016 08:10 PM, Pedro Alves wrote:
> On 06/17/2016 12:55 PM, Yao Qi wrote:
>> Pedro Alves <palves@redhat.com> 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.  */

Thanks,
Pedro Alves


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