From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56124 invoked by alias); 24 Jun 2016 19:10:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 56016 invoked by uid 89); 24 Jun 2016 19:10:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Limit, Forget X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 24 Jun 2016 19:10:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E7DF60B2; Fri, 24 Jun 2016 19:10:51 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5OJAoJN022788; Fri, 24 Jun 2016 15:10:50 -0400 Subject: Re: [PATCH v4 2/3] Forget watchpoint locations when inferior exits or is killed/detached To: Yao Qi References: <1466119968-15171-1-git-send-email-palves@redhat.com> <1466119968-15171-3-git-send-email-palves@redhat.com> <86oa70rpv7.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <29fd882b-a60e-ed27-ff15-2399c9551668@redhat.com> Date: Fri, 24 Jun 2016 19:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <86oa70rpv7.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-06/txt/msg00404.txt.bz2 On 06/17/2016 12:55 PM, Yao Qi wrote: > Pedro Alves 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]. Thanks, Pedro Alves