From: Phil Muldoon <pmuldoon@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch][python] Fix python/14513
Date: Wed, 18 Sep 2013 20:34:00 -0000 [thread overview]
Message-ID: <523A0E4E.3090105@redhat.com> (raw)
In-Reply-To: <877gedub9p.fsf@fleche.redhat.com>
On 18/09/13 21:26, Tom Tromey wrote:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> Parameters normally report what the value has been set too:
> Phil> (gdb) set foobar 5
> Phil> foobar has been set to 5.
>
> Phil> This patch just checks the string length of the output string before
> Phil> printing it.
>
> Phil> OK?
>
> Built-in parameters don't seem to do this printing:
>
> (gdb) set print elements 500
> (gdb)
>
> I think the Python layer should follow this precedent.
> Maybe get_set_string can be entirely removed.
If you look at the testsuite for py-param, they do have this option.
I have no opinion about this, but if we remove it I think we will we
be breaking our API promise? This functionality has been in there
for awhile.
Here is an example from the testsuite:
class TestParam (gdb.Parameter):
"""When enabled, test param does something useful. When disabled, does nothing."""
show_doc = "Show the state of the boolean test-param"
set_doc = "Set the state of the boolean test-param"
def get_show_string (self, pvalue):" ""\
return "The state of the Test Parameter is " + pvalue
def get_set_string (self):
val = "on"
if (self.value == False):
val = "off"
return "Test Parameter has been set to " + val
def __init__ (self, name):
super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
self.value = True
test_param = TestParam ('print test-param')
Notice that get_set_string, a callback, has a return value. I felt it
best in these circumstances to maintain API compatibility and do the
empty string check.
What do you think?
Cheers,
Phil
next prev parent reply other threads:[~2013-09-18 20:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 13:17 Phil Muldoon
2013-09-18 20:26 ` Tom Tromey
2013-09-18 20:34 ` Phil Muldoon [this message]
2013-09-18 20:40 ` Tom Tromey
2013-10-02 9:30 ` Phil Muldoon
2013-10-21 21:58 ` Tom Tromey
2013-10-30 9:01 ` Phil Muldoon
2013-11-08 3:18 ` Tom Tromey
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=523A0E4E.3090105@redhat.com \
--to=pmuldoon@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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