From: Daniel Colascione <daniel@censorshipresearch.org>
To: gdb-patches@sources.redhat.com
Subject: Re: Less verbose Python commands
Date: Sun, 10 Jan 2010 08:14:00 -0000 [thread overview]
Message-ID: <hic27v$365$1@ger.gmane.org> (raw)
In-Reply-To: <hic1fj$18s$1@ger.gmane.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 1/10/10 3:00 AM, Daniel Colascione wrote:
> [snip]
Err, this version propagates docstrings to command help too:
def command(*init_args):
def decorator(func):
def init_func(self):
gdb.Command.__init__(self, *init_args)
def invoke_func(self, argument, from_tty):
func(argument, from_tty)
type('Command_' + init_args[0].replace(' ', '_'),
(gdb.Command,),
{ '__init__': init_func,
'__doc__': func.__doc__,
'invoke': invoke_func })()
return func
return decorator
@command('tracked', COMMAND_DATA, COMPLETE_NONE, True)
def func(argument, from_tty):
"Commands having to do with tracked things"
@command('tracked types', COMMAND_DATA)
def func(argument, from_tty):
"List the types of objects which are tracked"
print parse_and_eval('2+2')
# etc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
iEYEARECAAYFAktJjEAACgkQ17c2LVA10VutRwCgucOLY5Vn8aNS2+XZZUpSZUaA
AfUAn0m+MbHAcrC1LuL3jrdPH17QO1st
=Y4db
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2010-01-10 8:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-10 8:05 Daniel Colascione
2010-01-10 8:14 ` Daniel Colascione [this message]
2010-01-11 21:32 ` 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='hic27v$365$1@ger.gmane.org' \
--to=daniel@censorshipresearch.org \
--cc=gdb-patches@sources.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