Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
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 20:02:00 -0000	[thread overview]
Message-ID: <m3prhydl8e.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20090204003153.GA26840@caradoc.them.org> (Daniel Jacobowitz's message of "Tue\, 3 Feb 2009 19\:31\:53 -0500")

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

>> +@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.

Daniel> Any opinion on making it always a string?  The 'do I get NULL
Daniel> or an empty string?' ambiguity shows up every time I write a
Daniel> new command in C.

An empty string would be fine by me.  I initially chose None to
parallel the C API, but it isn't clear how useful that is.  An empty
string is friendlier and doesn't seem to lose anything important.

>> +  /* For a prefix command, this is the list of sub-commands.  */
>> +  struct cmd_list_element *sub_list;

Daniel> What's sub_list for?  There's *command->prefixlist too.  Overall, I'm
Daniel> confused about why prefix commands are 'special' here.  When core GDB
Daniel> adds a command, it doesn't need any new code to handle it as a prefix;
Daniel> just calls add_prefix_cmd.  I'd expect to do the same here but fill in
Daniel> a local FUN.

I might be confused here.

The reason I wrote things this way is because elsewhere in gdb there
are global cmdlists which are passed by address to the various add_*
functions.  The 'prefixlist' field of the prefix command points to one
of these globals.

E.g.: in breakpoint.c, there is a global breakpoint_set_cmdlist.  The
"set breakpoint" prefix command is constructed:

  add_prefix_cmd ("breakpoint", class_maintenance, set_breakpoint_cmd, _("\
Breakpoint specific settings\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior"),
		  &breakpoint_set_cmdlist, "set breakpoint ",
		  0/*allow-unknown*/, &setlist);

... this sets the new prefix command's prefixlist to
&breakpoint_set_cmdlist.

Then, calls to add_* to create sub-commands of this prefix are given
&breakpoint_set_cmdlist as an argument.

So, the idea behind this part of the patch is that we need to create
storage for this list somewhere.  In the rest of gdb this is done as a
global, but that won't fly here -- so we allocate it in the Command.

Does that answer your question?  Or, if I'm misunderstanding
something, could you say what?  I looked at this again and I still
don't see what might be wrong.

Daniel> Yes, alias and user are special.  User is where "define"'d commands
Daniel> go; should there be a command to show all Python-defined
Daniel> commands similar to "show user"?

As a user I don't really care if a command is implemented in Python.
But I don't oppose the idea if you think it is useful.

Tom


  reply	other threads:[~2009-02-04 20:02 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
2009-02-04 20:02   ` Tom Tromey [this message]
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=m3prhydl8e.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --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