public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/31467] New: gdb python api with_parameter doesn't work correctly for "breakpoint pending"
@ 2024-03-09  2:51 mitch at runsafesecurity dot com
  2024-03-09  2:52 ` [Bug python/31467] " mitch at runsafesecurity dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mitch at runsafesecurity dot com @ 2024-03-09  2:51 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-12 14:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09  2:51 [Bug python/31467] New: gdb python api with_parameter doesn't work correctly for "breakpoint pending" mitch at runsafesecurity dot com
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

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