public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "mitch at runsafesecurity dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/31467] New: gdb python api with_parameter doesn't work correctly for "breakpoint pending"
Date: Sat, 09 Mar 2024 02:51:09 +0000	[thread overview]
Message-ID: <bug-31467-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31467
           Summary: gdb python api with_parameter doesn't work correctly
                    for "breakpoint pending"
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: mitch at runsafesecurity dot com
  Target Milestone: ---

Using `gdb.with_parameter` method with `breakpoint pending` fails and does not
restore original parameter value when original parameter is "auto".


```python
# foo.py
gdb.execute("show breakpoint pending")
print ("Old: ", gdb.parameter("breakpoint pending"))
with gdb.with_parameter("breakpoint pending", "on"):
    gdb.execute("show breakpoint pending")
    print ("New: ", gdb.parameter("breakpoint pending"))
```

```
(gdb) source foo.py
source foo.py
Debugger's behavior regarding pending breakpoints is auto.
Old:  None
Debugger's behavior regarding pending breakpoints is on.
New:  True
Traceback (most recent call last):
  File "foo.py", line 16, in <module>
    print ("New: ", gdb.parameter("breakpoint pending"))
  File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/local/share/gdb/python/gdb/__init__.py", line 263, in
with_parameter
    set_parameter(name, old_value)
  File "/usr/local/share/gdb/python/gdb/__init__.py", line 250, in
set_parameter
    execute("set " + name + " " + str(value), to_string=True)
gdb.error: "on", "off" or "auto" expected.
(gdb) source foo.py
source foo.py
Debugger's behavior regarding pending breakpoints is on.
Old:  True
Debugger's behavior regarding pending breakpoints is on.
New:  True
(gdb) 
```

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

             reply	other threads:[~2024-03-09  2:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09  2:51 mitch at runsafesecurity dot com [this message]
2024-03-09  2:52 ` [Bug python/31467] " mitch at runsafesecurity dot com
2024-03-09 13:05 ` ssbssa at sourceware dot org
2024-03-11 15:37 ` tromey at sourceware dot org
2024-03-12 14:07 ` tromey at sourceware dot org

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-31467-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).