public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/29217] New: gdb.set_parameter doesn't accept a bool where gdb.parameter returns one
@ 2022-06-01 12:11 plasmahh at gmx dot net
  2022-06-05 23:07 ` [Bug python/29217] " tromey at sourceware dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: plasmahh at gmx dot net @ 2022-06-01 12:11 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29217
           Summary: gdb.set_parameter doesn't accept a bool where
                    gdb.parameter returns one
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: plasmahh at gmx dot net
  Target Milestone: ---

bool settings return bools in python:

> python print(type(gdb.parameter("may-interrupt")))
<class 'bool'>


but do not accept them:

> python gdb.set_parameter("may-interrupt",False)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/plasmahh/opt/gdb/share/gdb/python/gdb/__init__.py", line 237, in
set_parameter
    execute("set " + name + " " + str(value), to_string=True)
gdb.error: "on" or "off" expected.
Error while executing Python code.


which paticularily also breaks gdb.with_parameter() for bool values.


While something like if( isinstance(gdb.parameter(name),bool) ): value = {
True:"on",False:"off"}[value]
will fix this particular case, it might make more sense to enhance the gdb core
functionality to accept "True" (and maybe "true") too since despite the
message, 1, "yes" and "enable" are already accepted.

-- 
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:[~2022-10-21  7:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 12:11 [Bug python/29217] New: gdb.set_parameter doesn't accept a bool where gdb.parameter returns one plasmahh at gmx dot net
2022-06-05 23:07 ` [Bug python/29217] " tromey at sourceware dot org
2022-07-08 20:07 ` cvs-commit at gcc dot gnu.org
2022-07-08 20:09 ` tromey at sourceware dot org
2022-10-21  7:56 ` cvs-commit at gcc dot gnu.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).