From: Daniel Jacobowitz <drow@false.org>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [RFC][python] Add support for commands implemented in Python
Date: Wed, 04 Feb 2009 00:32:00 -0000 [thread overview]
Message-ID: <20090204003153.GA26840@caradoc.them.org> (raw)
In-Reply-To: <1233580405.7000.13.camel@localhost.localdomain>
On Mon, Feb 02, 2009 at 11:13:25AM -0200, Thiago Jung Bauermann wrote:
> +@defmethod Command invoke argument from_tty
> +This method is called by @value{GDBN} when this command is invoked.
> +
> +@var{argument} is the argument to the command. The argument
> +ordinarily is a string, but may be @code{None}, meaning that there was
> +no argument.
Any opinion on making it always a string? The 'do I get NULL or an
empty string?' ambiguity shows up every time I write a new command in
C. If you prefer None, let's document what whitespace trimming does
or does not happen before it is converted from a string to None.
> +@defmethod Command complete text word
> +This method is called by @value{GDBN} when the user attempts @key{TAB}
> +completion on this command.
> +
> +The arguments @var{text} and @var{word} are both strings. @var{text}
> +holds the complete command line up to the cursor's location.
> +@var{word} holds the last word of the command line; this is computed
> +using a word-breaking heuristic.
> +
> +The @code{invoke} method can return several values:
Isn't this @code{complete} method? Same problem repeated below.
> +/* A gdb command. For the time being only ordinary commands (not
> + set/show commands) are allowed. */
> +struct cmdpy_object
> +{
> + PyObject_HEAD
> +
> + /* The corresponding gdb command object, or NULL if the command is
> + no longer installed. */
> + struct cmd_list_element *command;
> +
> + /* For a prefix command, this is the list of sub-commands. */
> + struct cmd_list_element *sub_list;
> +};
What's sub_list for? There's *command->prefixlist too. Overall, I'm
confused about why prefix commands are 'special' here. When core GDB
adds a command, it doesn't need any new code to handle it as a prefix;
just calls add_prefix_cmd. I'd expect to do the same here but fill in
a local FUN.
> + /* Note: alias and user seem to be special; pseudo appears to be
> + unused, and there is no reason to expose tui or xdb, I think. */
Yes, alias and user are special. User is where "define"'d commands
go; should there be a command to show all Python-defined
commands similar to "show user"?
The rest of the code looks fine.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2009-02-04 0:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 13:13 Thiago Jung Bauermann
2009-02-02 20:08 ` Eli Zaretskii
2009-02-04 19:50 ` Tom Tromey
2009-02-05 22:40 ` Thiago Jung Bauermann
2009-02-05 23:01 ` Tom Tromey
2009-02-06 6:18 ` Eli Zaretskii
2009-02-06 22:12 ` Thiago Jung Bauermann
2009-02-06 20:52 ` Tom Tromey
2009-02-06 21:35 ` Thiago Jung Bauermann
2009-02-07 10:02 ` Eli Zaretskii
2009-02-08 23:57 ` Thiago Jung Bauermann
2009-02-15 15:47 ` Thiago Jung Bauermann
2009-02-04 0:32 ` Daniel Jacobowitz [this message]
2009-02-04 20:02 ` Tom Tromey
2009-02-04 20:12 ` Daniel Jacobowitz
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=20090204003153.GA26840@caradoc.them.org \
--to=drow@false.org \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sourceware.org \
/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