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 8CB7A3857728 for ; Tue, 9 May 2023 18:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CB7A3857728 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 262AD1E0D4; Tue, 9 May 2023 14:50:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1683658235; bh=7j9TfHJc9j8YcXgPi3bbMhsqvC5RfYXOYbvVwQBcL8A=; h=Date:Subject:To:References:From:In-Reply-To:From; b=osG4yG5W5lgoySSGc2FJ+921fxZieE1pOLiwQ0EVdRZJNOTAXwiejzEg+EeOjzyZm ZAMr41m2kmvTjIhvyXksb5cjhDSiUQz82byvuIQS9js7B/pFxLVaAov8Rw+kgQyt7E u5ZVoeWS2PmETIQPTpNVKN0lCx0Z3AgvLlz9CtDg= Message-ID: Date: Tue, 9 May 2023 14:50:34 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH v5] [PR python/29603] Disable out-of-scope watchpoints Content-Language: fr To: Johnson Sun , Lancelot SIX , gdb-patches@sourceware.org References: <1b60c407-1406-ed3c-7d64-a79c786ae9b7@gmail.com> <20230423095408.7638-1-j3.soon777@gmail.com> From: Simon Marchi In-Reply-To: <20230423095408.7638-1-j3.soon777@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.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 4/23/23 05:54, Johnson Sun 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 Hi, Hmm, re-testing the patch, it now just times out like this: (gdb) PASS: gdb.python/py-watchpoint.exp: check modified BP count continue Continuing. Watchpoint Hit: 1 FAIL: gdb.python/py-watchpoint.exp: run until program stops (timeout) python print(bpt.n) It basically hangs there. Do you see this? Simon