public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "j3.soon777 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/29603] New: Python Watchpoints are not deleted
Date: Fri, 23 Sep 2022 08:02:52 +0000	[thread overview]
Message-ID: <bug-29603-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29603

            Bug ID: 29603
           Summary: Python Watchpoints are not deleted
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: j3.soon777 at gmail dot com
  Target Milestone: ---

In Python, if we register a local software watchpoint and set the
`Breakpoint.stop' function to always return `False', the watchpoint will not be
deleted when going out of scope.

This cause gdb to incorrectly trigger the `Breakpoint.stop' function many more
times than it should.

This issue is reproduced in:
- GCC 7.5.0 & GDB 10.2 on Ubuntu 18.04,
- GCC 9.3.0 & GDB 9.2 on Ubuntu 20.04 (WSL on Windows),
- GCC 11.2.0 & GDB 12.0.90 on Ubuntu 22.04,
- and on current GDB HEAD (commit 8e037eae6823caf5b9cb5b4feb3de838abb25956).

Please see the attachment for the testing files.

Commands to reproduce:

        gcc -g test.c
        gdb a.out
        (gdb) set can-use-hw-watchpoints 0
        (gdb) b main
        (gdb) r
        (gdb) source test.py
        (gdb) c
        Continuing.
        Watchpoint Hit: 1
        Watchpoint Hit: 2
        Watchpoint Hit: 3

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 4

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 5

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 6

        ...

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 1201

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 1202

        Watchpoint 2 deleted because the program has left the block in
        which its expression is valid.
        Watchpoint Hit: 1203
        [Inferior 1 (process 17119) exited normally]

Please note that the Watchpoint in the test file should only be hit 4 times.

I'm currently working on a patch to fix this bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-09-23  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23  8:02 j3.soon777 at gmail dot com [this message]
2022-09-23  8:03 ` [Bug python/29603] " j3.soon777 at gmail dot com
2022-09-23  8:04 ` j3.soon777 at gmail dot com
2022-09-23  8:04 ` j3.soon777 at gmail dot com
2022-09-25  5:36 ` j3.soon777 at gmail dot com
2023-05-11 16:10 ` cvs-commit at gcc dot gnu.org
2024-01-14 14:26 ` ssbssa at sourceware dot org
2024-01-24 14:04 ` j3.soon777 at gmail dot com

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=bug-29603-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).