From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 767E53858C5F for ; Thu, 11 May 2023 16:09:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 767E53858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 098A51E114; Thu, 11 May 2023 12:09:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1683821396; bh=TVQVGAE0pSspGdoYwxyoBJT46jtC6TNYnPiqmstCT8o=; h=Date:Subject:To:References:From:In-Reply-To:From; b=m4Ta21oRaucE7EDy+2MyX7DM0/XH6dynd0o4ux8mRGuS9LkjjeQU+YzrSe4mlCJpw 1MEnpkr6r50hNwxsRnKdG6itCmn1sHO2ERSZGveqhfaQhfQFAWahncrD7b22NYWAYN YGsnG51ekxEeGkOvx1/Mn+8vfS4mbptN268CzDDY= Message-ID: <65fce721-1f0b-75e7-b857-367d61de9004@simark.ca> Date: Thu, 11 May 2023 12:09:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v6] [PR python/29603] Disable out-of-scope watchpoints Content-Language: fr To: Johnson Sun , Lancelot SIX , gdb-patches@sourceware.org References: <20230511154619.23575-1-j3.soon777@gmail.com> From: Simon Marchi In-Reply-To: <20230511154619.23575-1-j3.soon777@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/11/23 11:46, Johnson Sun via Gdb-patches wrote: > Currently, when a local software watchpoint goes out of scope, GDB sets > the watchpoint's disposition to `delete at next stop' and then normal > stops (i.e., stop and wait for the next GDB command). When GDB normal > stops, it automatically deletes the breakpoints with their disposition > set to `delete at next stop'. > > Suppose a Python script decides not to normal stop when a local > software watchpoint goes out of scope, the watchpoint will not be > automatically deleted even when its disposition is set to > `delete at next stop'. > > Since GDB single-steps the program and tests the watched expression > after each instruction, not deleting the watchpoint causes the > watchpoint to be hit many more times than it should, as reported in > PR python/29603. > > This was happening because the watchpoint is not deleted or disabled > when going out of scope. > > This commit fixes this issue by disabling the watchpoint when going out > of scope. It also adds a test to ensure this feature isn't regressed in > the future. > > Calling `breakpoint_auto_delete' on all kinds of stops (in > `fetch_inferior_event') seem to solve this issue, but is in fact > inappropriate, since `breakpoint_auto_delete' goes over all breakpoints > instead of just going through the bpstat chain (which only contains the > breakpoints that were hit right now). > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29603 Thanks, this version of the test works fine for me. I'll go ahead and push the patch. Simon