From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117724 invoked by alias); 1 Jul 2016 10:49:10 -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 117706 invoked by uid 89); 1 Jul 2016 10:49:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Limit 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, 01 Jul 2016 10:49:06 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 ADA073B70D; Fri, 1 Jul 2016 10:49:05 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u61An4I6005040; Fri, 1 Jul 2016 06:49:04 -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> <29fd882b-a60e-ed27-ff15-2399c9551668@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <482da424-c2f9-ed38-aa99-7a4cbc47adcf@redhat.com> Date: Fri, 01 Jul 2016 10:49: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: <29fd882b-a60e-ed27-ff15-2399c9551668@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-07/txt/msg00001.txt.bz2 On 06/24/2016 08:10 PM, Pedro Alves wrote: > 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]. 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