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
* [Bug python/29217] gdb.set_parameter doesn't accept a bool where gdb.parameter returns one
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 ` tromey at sourceware dot org
2022-07-08 20:07 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-06-05 23:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29217
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
Status|UNCONFIRMED |NEW
CC| |tromey at sourceware dot org
Last reconfirmed| |2022-06-05
Ever confirmed|0 |1
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch for this.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/29217] gdb.set_parameter doesn't accept a bool where gdb.parameter returns one
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
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-08 20:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29217
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fa17a6814113ac22d8059d61514aa2c6e29b0aae
commit fa17a6814113ac22d8059d61514aa2c6e29b0aae
Author: Tom Tromey <tom@tromey.com>
Date: Sun Jun 12 11:36:08 2022 -0600
Handle bool specially in gdb.set_parameter
PR python/29217 points out that gdb.parameter will return bool values,
but gdb.set_parameter will not properly accept them. This patch fixes
the problem by adding a special case to set_parameter.
I looked at a fix involving rewriting set_parameter in C++. However,
this one is simpler.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29217
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/29217] gdb.set_parameter doesn't accept a bool where gdb.parameter returns one
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
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-07-08 20:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29217
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |13.1
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug python/29217] gdb.set_parameter doesn't accept a bool where gdb.parameter returns one
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
` (2 preceding siblings ...)
2022-07-08 20:09 ` tromey at sourceware dot org
@ 2022-10-21 7:56 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-21 7:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29217
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c506be7d9be55721a44d38782309d8f7fcd5e99e
commit c506be7d9be55721a44d38782309d8f7fcd5e99e
Author: Maciej W. Rozycki <macro@embecosm.com>
Date: Fri Oct 21 08:54:18 2022 +0100
GDB/Python: Make `None' stand for `unlimited' in setting integer parameters
Similarly to booleans and following the fix for PR python/29217 make
`gdb.parameter' accept `None' for `unlimited' with parameters of the
PARAM_UINTEGER, PARAM_INTEGER, and PARAM_ZUINTEGER_UNLIMITED types, as
`None' is already returned by parameters of the two former types, so
one might expect to be able to feed it back. It also makes it possible
to avoid the need to know what the internal integer representation is
for the special setting of `unlimited'.
Expand the testsuite accordingly.
Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
--
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).