From: Doug Evans <dje@google.com>
To: Scott Goldman <scottjg@vmware.com>
Cc: Phil Muldoon <pmuldoon@redhat.com>, "eliz@gnu.org" <eliz@gnu.org>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
Date: Thu, 23 Feb 2012 03:03:00 -0000 [thread overview]
Message-ID: <CADPb22QFN2+NbwQe6A2KGL98yyVX8p6j5Xm4t0wYng_J4gcG=Q@mail.gmail.com> (raw)
In-Reply-To: <03E840D17E263A48A5766AD576E0423A03D72B6547@exch-mbx-111.vmware.com>
Hi. Sorry for the delay. I recommend one documentation tweak, but
other than that this patch is ok with me.
On Wed, Feb 15, 2012 at 1:14 AM, Scott Goldman <scottjg@vmware.com> wrote:
> Hi Phil, Eli, Doug.
>
> Thanks for the feedback. I adjusted the changelog, added a test case, and updated the documentation as per your suggestions.
>
>> [Doug]
>> The documentation needs to make clear that "user" means "those
>> commands defined in class_user" and not any command defined by the
>> user.
>
> I think I understand what you're saying. I suppose the distinction is that `help user-defined` may now show python commands in addition to what are traditionally known as user-defined commands. I updated the documentation to reflect this. I no longer use the phrase "user-defined python commands", instead I refer to commands as "user-defined commands" or "python commands". I also clarified that `help user-defined` may also show python commands that were declared under COMMAND_USER. Hopefully that's what you had in mind. Any further suggestions on how you'd like the doc reworked are welcome.
>
> -sjg
>
>
> gdb/doc/ChangeLog
> 2012-02-15 Scott J. Goldman <scottjg@vmware.com>
>
> * gdb.texinfo (Commands In Python): Put example python macro in
> COMMAND_USER category rather than COMMAND_OBSCURE.
> (User-defined Commands) : Update documentation to clarify
> `set/show max-user-call-depth` and `show user` don't apply to python
> commands.
> (User-defined Commands) : Update documentation to clarify
> `help user-defined` may also include python commands defined as
> COMMAND_USER
>
> gdb/ChangLog
> 2012-02-15 Scott J. Goldman <scottjg@vmware.com>
>
> * cli/cli-cmds.c (show_user): Print error when used on a python command.
> (init_cli_cmds): Update documentation strings for `show user` and
> `set/show max-user-call-depth` to clarify that it does not apply to
> python commands.
> * python/py-cmd.c (cmdpy_init): Treat class_user as a valid class in error
> check
> (gdbpy_initialize_commands): Add COMMAND_USER as a constant in
> gdb python api.
> * top.c (execute_command): Only execute a user-defined command as a
> legacy macro if c->user_commands is set.
>
> gdb/testsuite/ChangeLog
> 2012-02-15 Scott J. Goldman <scottjg@vmware.com>
>
> * gdb.python/py-cmd.exp: Add test to verify that python commands can
> be put in the user-defined category and that the commands appear in
> `help user-defined`.
>
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index 983f017..49808b6 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -1241,7 +1241,8 @@ show_user (char *args, int from_tty)
> char *comname = args;
>
> c = lookup_cmd (&comname, cmdlist, "", 0, 1);
> - if (c->class != class_user)
> + /* c->user_commands would be NULL if it's a python command */
> + if (c->class != class_user || !c->user_commands)
> error (_("Not a user command."));
> show_user_1 (c, "", args, gdb_stdout);
> }
> @@ -1912,7 +1913,7 @@ Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
> Run the ``make'' program using the rest of the line as arguments."));
> set_cmd_completer (c, filename_completer);
> add_cmd ("user", no_class, show_user, _("\
> -Show definitions of user defined commands.\n\
> +Show definitions of non-python user defined commands.\n\
> Argument is the name of the user defined command.\n\
> With no argument, show definitions of all user defined commands."), &showlist);
> add_com ("apropos", class_support, apropos_command,
> @@ -1920,8 +1921,8 @@ With no argument, show definitions of all user defined commands."), &showlist);
>
> add_setshow_integer_cmd ("max-user-call-depth", no_class,
> &max_user_call_depth, _("\
> -Set the max call depth for user-defined commands."), _("\
> -Show the max call depth for user-defined commands."), NULL,
> +Set the max call depth for non-python user-defined commands."), _("\
> +Show the max call depth for non-python user-defined commands."), NULL,
> NULL,
> show_max_user_call_depth,
> &setlist, &showlist);
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 9edc6ad..302c203 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -21054,14 +21054,16 @@ command should not be repeated when the user hits @key{RET}
> @kindex help user-defined
> @item help user-defined
> List all user-defined commands, with the first line of the documentation
> -(if any) for each.
> +(if any) for each. This may include python commands as well, if they were
> +defined under the COMMAND_USER class.
I would change this to something like:
List all user-defined commands and all python commands defined in
class COMMAND_USER. For user-defined commands, the first line of the
documentation (if any) is included.
next prev parent reply other threads:[~2012-02-23 0:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 0:49 Scott Goldman
2012-02-14 3:12 ` Doug Evans
2012-02-14 7:57 ` Scott Goldman
2012-02-14 18:09 ` Eli Zaretskii
2012-02-14 20:19 ` Doug Evans
2012-02-14 12:48 ` Phil Muldoon
2012-02-15 9:27 ` Scott Goldman
2012-02-16 14:23 ` Phil Muldoon
2012-02-16 17:16 ` Eli Zaretskii
2012-02-23 3:03 ` Doug Evans [this message]
2012-02-23 3:32 ` Scott Goldman
2012-02-23 4:24 ` Eli Zaretskii
2012-02-23 5:13 ` Scott Goldman
2012-02-23 6:03 ` Doug Evans
2012-02-23 6:56 ` Scott Goldman
2012-02-23 8:21 ` Scott Goldman
2012-02-24 23:49 ` Scott Goldman
2012-02-28 1:36 ` Doug Evans
2012-02-28 4:18 ` Scott Goldman
2012-02-28 7:51 ` Doug Evans
2012-02-29 0:45 ` [doc RFA] " Doug Evans
2012-02-29 4:17 ` Eli Zaretskii
2012-03-01 19:31 ` Doug Evans
2012-03-01 20:26 ` Keith Seitz
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='CADPb22QFN2+NbwQe6A2KGL98yyVX8p6j5Xm4t0wYng_J4gcG=Q@mail.gmail.com' \
--to=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.com \
--cc=scottjg@vmware.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