From: Johnson Sun <j3.soon777@gmail.com>
To: SimonMarchi <simark@simark.ca>, JohnsonSun <j3.soon777@gmail.com>,
LancelotSIX <lsix@lancelotsix.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH v5] [PR python/29603] Disable out-of-scope watchpoints
Date: Thu, 11 May 2023 01:22:03 +0800 [thread overview]
Message-ID: <1b0edc1f-0783-e262-2138-6982a18ddf97@gmail.com> (raw)
In-Reply-To: <c147c484-8b8c-ca10-1c99-4454efe7ea54@simark.ca>
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
>
next prev parent reply other threads:[~2023-05-10 17:22 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-25 5:33 [PATCH] [PR python/29603] Fix deletion of Watchpoints Johnson Sun
2022-09-25 18:10 ` Lancelot SIX
2022-10-01 5:20 ` Johnson Sun
2022-10-01 5:27 ` [PATCH v2] [PR python/29603] Disable out-of-scope watchpoints Johnson Sun
2022-10-20 17:57 ` Johnson Sun
2022-10-20 18:11 ` [PATCH v3] " Johnson Sun
2022-11-18 12:17 ` [PING] " Johnson Sun
2022-11-25 15:11 ` [PING^2] " Johnson Sun
2022-12-04 16:45 ` [PING^3] " Johnson Sun
2022-12-12 21:44 ` [PING^4] " Johnson Sun
2022-12-20 22:08 ` [PING^5] " Johnson Sun
2022-12-27 16:40 ` [PING^6] " Johnson Sun
2023-01-12 18:34 ` [PING^7] " Johnson Sun
2023-01-13 15:40 ` Simon Marchi
2023-01-23 10:15 ` Johnson Sun
2023-02-18 16:26 ` [PING] " Johnson Sun
2023-02-26 6:16 ` [RFC] " Johnson Sun
2023-03-12 17:24 ` [PING] " Johnson Sun
2023-03-13 16:00 ` Simon Marchi
2023-03-23 18:25 ` Johnson Sun
2023-03-23 18:31 ` [PATCH v4] " Johnson Sun
2023-04-09 20:47 ` Johnson Sun
2023-04-09 20:49 ` [PING] " Johnson Sun
2023-04-17 18:18 ` [PING^2] " Johnson Sun
2023-04-17 18:56 ` Simon Marchi
2023-04-23 9:46 ` Johnson Sun
2023-04-23 9:54 ` [PATCH v5] " Johnson Sun
2023-05-06 19:06 ` [PING] " Johnson Sun
2023-05-09 18:50 ` Simon Marchi
2023-05-10 17:22 ` Johnson Sun [this message]
2023-05-11 2:08 ` Simon Marchi
2023-05-11 15:46 ` [PATCH v6] " Johnson Sun
2023-05-11 16:09 ` Simon Marchi
2023-05-11 15:50 ` [PATCH v5] " Johnson Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b0edc1f-0783-e262-2138-6982a18ddf97@gmail.com \
--to=j3.soon777@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).