From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 828F33858439 for ; Wed, 10 May 2023 17:22:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 828F33858439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-643a1fed360so4240624b3a.3 for ; Wed, 10 May 2023 10:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683739328; x=1686331328; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=NXSH17DvZQ800ObROJvJBcmDsPfv/+OpVbd53ZmpQDc=; b=m440GMFAHaur7ZN5GU4j5+4UdMbrfygjUg5OdiR6VZ6z3G/ifXPqKxQz5K1n9pRSBR dIbs1Mh4vgURGwwrVFp1T8Df8yePTE4FS8QOKRC09uMsUzNa4N+5JxvgXiaoakiQIPWZ g7kDvWWLBcnYaK26bI9qqShYN+U8rgwXn3tCDL9i6okcYPRVXh4CD/neE74EwkQaohxk sG1ysxmEWFeHhMEfeS8k3paMpwUXntO7FD6NzlSxWUm/lcWEyrX3WG4PSjeHY2Eijhxn AWXq8ot44n1bbOowV3G6f9SazC+zv9vmEK1vIPa5M8J39omfaHTDjOeTLczF8heuBG/F 15yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683739328; x=1686331328; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NXSH17DvZQ800ObROJvJBcmDsPfv/+OpVbd53ZmpQDc=; b=SNFCx8fGDrC0w68gGx2/ysbL6g+pj+oDItQ/1GLafQqGoUgnCerPOsRk525gnRsvZb mdB+W9Vb34MWX/Cf8UK/U6IGHCW4WrFHxxS7EMEmwaG+APiKfuBnma4S6sI4jXa2pynR xEF+Shv3vDPg4FvYmWrADnWSbx1P2d+wkW67Xh8+0SFy/1zDEiooTzT/4D+iUhNT1l9L b7V5vDXn3JADoCgsTLK9KE5KsQYCkcckCh+aiqyQI4sRmgdnCClEsjayk6mL8BKdx3sz evm27oR3Ih3BTmrgOX4By1K7QcmQMqfaRksc/+yK9CuJSnsTAcCJ2tRns2hrd8hwvKtT Fj7A== X-Gm-Message-State: AC+VfDyWuHEeWL+PrrNOKCTLvOU5++7HGFXjGQkBvwFQNH1fq/Y/apnw jF/BF36McT9YFyexyMKMFpkvs0B20PpBvg== X-Google-Smtp-Source: ACHHUZ7INhqrKahzWcT91AeAReh5hzvYN+QpHcmvTEa3I7+98f7oinrIveyTpUHwSrC2ghoczOpBzw== X-Received: by 2002:a17:903:2304:b0:1a6:a7d4:7474 with SMTP id d4-20020a170903230400b001a6a7d47474mr19853076plh.44.1683739328459; Wed, 10 May 2023 10:22:08 -0700 (PDT) Received: from [192.168.117.2] (sd237023.ching-de.ab.nthu.edu.tw. [140.114.237.23]) by smtp.gmail.com with ESMTPSA id u20-20020a17090adb5400b0024e149fe03dsm13800037pjx.25.2023.05.10.10.22.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 May 2023 10:22:08 -0700 (PDT) Message-ID: <1b0edc1f-0783-e262-2138-6982a18ddf97@gmail.com> Date: Thu, 11 May 2023 01:22:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH v5] [PR python/29603] Disable out-of-scope watchpoints To: SimonMarchi , JohnsonSun , LancelotSIX , gdb-patches@sourceware.org References: <1b60c407-1406-ed3c-7d64-a79c786ae9b7@gmail.com> <20230423095408.7638-1-j3.soon777@gmail.com> Content-Language: en-US From: Johnson Sun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: Hi, I just applied the patch to commit 39453f9d8cf03b382d34f3548706f1ae5916e34e, and tested with the following commands on a clean Ubuntu 22.04 LTS machine:     make check TESTS="gdb.python/py-watchpoint.exp"     make check TESTS="gdb.python/py-watchpoint.exp" RUNTESTFLAGS="--target_board=native-gdbserver"     make check TESTS="gdb.python/py-watchpoint.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver" all 3 commands above passed the tests (10/10) on my machine. I'm unsure why the test times out on your machine. Could you provide information regarding the base commit that was used and the operating system installed? Best regards, Johnson On 5/10/2023 2:50 AM, SimonMarchi wrote: > 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 >