From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28527 invoked by alias); 23 Feb 2012 00:35:27 -0000 Received: (qmail 28160 invoked by uid 22791); 23 Feb 2012 00:35:25 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,TW_SJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Feb 2012 00:35:12 +0000 Received: by vcbf13 with SMTP id f13so609403vcb.0 for ; Wed, 22 Feb 2012 16:35:11 -0800 (PST) Received-SPF: pass (google.com: domain of dje@google.com designates 10.52.97.34 as permitted sender) client-ip=10.52.97.34; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dje@google.com designates 10.52.97.34 as permitted sender) smtp.mail=dje@google.com; dkim=pass header.i=dje@google.com Received: from mr.google.com ([10.52.97.34]) by 10.52.97.34 with SMTP id dx2mr16103427vdb.54.1329957311536 (num_hops = 1); Wed, 22 Feb 2012 16:35:11 -0800 (PST) Received: by 10.52.97.34 with SMTP id dx2mr13184815vdb.54.1329957311480; Wed, 22 Feb 2012 16:35:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.97.34 with SMTP id dx2mr13184804vdb.54.1329957311353; Wed, 22 Feb 2012 16:35:11 -0800 (PST) Received: by 10.220.21.4 with HTTP; Wed, 22 Feb 2012 16:35:11 -0800 (PST) In-Reply-To: <03E840D17E263A48A5766AD576E0423A03D72B6547@exch-mbx-111.vmware.com> References: <03E840D17E263A48A5766AD576E0423A03D72B653F@exch-mbx-111.vmware.com> <4F3A5820.3080905@redhat.com> <03E840D17E263A48A5766AD576E0423A03D72B6547@exch-mbx-111.vmware.com> Date: Thu, 23 Feb 2012 03:03:00 -0000 Message-ID: Subject: Re: [PATCH] Allow user-defined as a category for python gdb macros (resend) From: Doug Evans To: Scott Goldman Cc: Phil Muldoon , "eliz@gnu.org" , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQndOP2pF2wc9BX5Q0z4Zqi+1+2iHuv72sKlUcfGIKCs+WveOvBsv6e7fmnnwZUSJcQ6N50yuG2vaHuN+6yTna9DNzUZEiGyEYf8C/dJWJTzKmXooVNzTqdSJABuotbA7dd2M2zvnq+ry0tIToFb7dAnNGcyOg== X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00491.txt.bz2 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 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 tha= t `help user-defined` may now show python commands in addition to what are = traditionally known as user-defined commands. I updated the documentation t= o 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 t= hat 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 =A0Scott J. Goldman > > =A0 =A0 =A0 =A0* gdb.texinfo (Commands In Python): Put example python mac= ro in > =A0 =A0 =A0 =A0COMMAND_USER category rather than COMMAND_OBSCURE. > =A0 =A0 =A0 =A0(User-defined Commands) : Update documentation to clarify > =A0 =A0 =A0 =A0`set/show max-user-call-depth` and `show user` don't apply= to python > =A0 =A0 =A0 =A0 commands. > =A0 =A0 =A0 =A0(User-defined Commands) : Update documentation to clarify > =A0 =A0 =A0 `help user-defined` may also include python commands defined = as > =A0 =A0 =A0 =A0COMMAND_USER > > gdb/ChangLog > 2012-02-15 =A0Scott J. Goldman > > =A0 =A0 =A0 =A0* cli/cli-cmds.c (show_user): Print error when used on a p= ython command. > =A0 =A0 =A0 =A0(init_cli_cmds): Update documentation strings for `show us= er` and > =A0 =A0 =A0 =A0`set/show max-user-call-depth` to clarify that it does not= apply to > =A0 =A0 =A0 =A0python commands. > =A0 =A0 =A0 =A0* python/py-cmd.c (cmdpy_init): Treat class_user as a vali= d class in error > =A0 =A0 =A0 =A0check > =A0 =A0 =A0 =A0(gdbpy_initialize_commands): Add COMMAND_USER as a constan= t in > =A0 =A0 =A0 =A0gdb python api. > =A0 =A0 =A0 =A0* top.c (execute_command): Only execute a user-defined com= mand as a > =A0 =A0 =A0 =A0legacy macro if c->user_commands is set. > > gdb/testsuite/ChangeLog > 2012-02-15 =A0Scott J. Goldman > > =A0 =A0 =A0 =A0* gdb.python/py-cmd.exp: Add test to verify that python co= mmands can > =A0 =A0 =A0 =A0be put in the user-defined category and that the commands = appear in > =A0 =A0 =A0 `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) > =A0 =A0 =A0 char *comname =3D args; > > =A0 =A0 =A0 c =3D lookup_cmd (&comname, cmdlist, "", 0, 1); > - =A0 =A0 =A0if (c->class !=3D class_user) > + =A0 =A0 =A0/* c->user_commands would be NULL if it's a python command */ > + =A0 =A0 =A0if (c->class !=3D class_user || !c->user_commands) > =A0 =A0 =A0 =A0error (_("Not a user command.")); > =A0 =A0 =A0 show_user_1 (c, "", args, gdb_stdout); > =A0 =A0 } > @@ -1912,7 +1913,7 @@ Two arguments (separated by a comma) are taken as a= range of memory to dump,\n\ > =A0Run the ``make'' program using the rest of the line as arguments.")); > =A0 set_cmd_completer (c, filename_completer); > =A0 add_cmd ("user", no_class, show_user, _("\ > -Show definitions of user defined commands.\n\ > +Show definitions of non-python user defined commands.\n\ > =A0Argument is the name of the user defined command.\n\ > =A0With no argument, show definitions of all user defined commands."), &s= howlist); > =A0 add_com ("apropos", class_support, apropos_command, > @@ -1920,8 +1921,8 @@ With no argument, show definitions of all user defi= ned commands."), &showlist); > > =A0 add_setshow_integer_cmd ("max-user-call-depth", no_class, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &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, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 show_max_user_call_de= pth, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &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 hi= ts @key{RET} > =A0@kindex help user-defined > =A0@item help user-defined > =A0List all user-defined commands, with the first line of the documentati= on > -(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.