* [PATCH] Allow user-defined as a category for python gdb macros (resend)
@ 2012-02-14 0:49 Scott Goldman
2012-02-14 3:12 ` Doug Evans
2012-02-14 12:48 ` Phil Muldoon
0 siblings, 2 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-14 0:49 UTC (permalink / raw)
To: gdb-patches
Hi.
The VMware legal folks and FSF legal folks seem to be done with their
back and forth, and I am told it is now legally ok for this patch to be
committed.
This patch allows python macros to coexist with legacy gdb macros in
user-defined category. This way, it's possible to organize your macros
such that `help user` shows both legacy and python macros. I also
modified the documentation to use the `user` category in the example
python macro. It seemed like a more reasonable default category than
`obscure`.
2012-02-13 Scott J. Goldman <scottjg@vmware.com>
* gdb.texinfo: put example python macro in COMMAND_USER category
rather than COMMAND_OBSCURE.
* 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.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9edc6ad..2a26cbe 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21871,7 +21871,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23311,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..8a91735 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,7 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-14 0:49 [PATCH] Allow user-defined as a category for python gdb macros (resend) Scott Goldman
@ 2012-02-14 3:12 ` Doug Evans
2012-02-14 7:57 ` Scott Goldman
2012-02-14 12:48 ` Phil Muldoon
1 sibling, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-02-14 3:12 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches
On Mon, Feb 13, 2012 at 4:48 PM, Scott Goldman <scottjg@vmware.com> wrote:
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -470,7 +470,7 @@ execute_command (char *p, int from_tty)
> if (c->flags & DEPRECATED_WARN_USER)
> deprecated_cmd_warning (&line);
>
> - if (c->class == class_user)
> + if (c->class == class_user && c->user_commands)
> execute_user_command (c, arg);
> else if (c->type == set_cmd || c->type == show_cmd)
> do_setshow_command (arg, from_tty, c);
This change is a bit obscure.
At the very least, I think this requires a proper comment explaining
why one needs to test c->user_commands.
Also, this patch feels like it's incomplete.
If I can see "user" python "macros" [sic] then happens if I do "show
user foo"? (a user may reasonably ask)
And given that that won't work, we'll have to explain(document) why.
Plus one now needs to explain that "document" and
"max-user-call-depth" don't apply to these commands (it may seem
obvious, but they show up in "apropos user-defined", and thus to not
document these things means the patch is incomplete).
I wonder if any more unforeseen changes will be needed.
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
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
0 siblings, 2 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-14 7:57 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Hi Doug.
I appreciate the comments.
> At the very least, I think this requires a proper comment explaining
> why one needs to test c->user_commands.
done.
> Also, this patch feels like it's incomplete.
> If I can see "user" python "macros" [sic] then happens if I do "show
> user foo"? (a user may reasonably ask)
> And given that that won't work, we'll have to explain(document) why.
I added the relevant documentation specifying the behavior. I'm not sure how I would explain it other than "because Python doesn't provide a way to retrieve the code" and I wasn't sure if this was sufficiently useful information to be worth documenting, so i just stuck to clarifying that the commands were only relevant for user-defined non-python commands.
I would prefer to just get the `show user ...` functionality to work for python commands. The python `inspect` module sounds promising, but unfortunately seems to just throw an exception when I use it on a class. I'll fool around with it some more. Maybe I can make it work for certain limited cases.
> Plus one now needs to explain that "document" and
> "max-user-call-depth" don't apply to these commands
`document` actually seems to work fine, but yeah `max-user-call-depth` is not relevant for python commands. I updated the documentation to reflect that.
I'd be happy to further develop the change based on more feedback. My only real goal is to be able to have all the user-defined commands listed in one place.
-sjg
2012-02-13 Scott J. Goldman <scottjg@vmware.com>
* gdb.texinfo: put example python macro in COMMAND_USER category
rather than COMMAND_OBSCURE.
* gdb.texinfo: update documentation to clarify set/show max-user-call-depth and show user don't apply to
* python commands.
2012-02-13 Scott J. Goldman <scottjg@vmware.com>
* 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.
* 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.
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..988d3d3 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21061,7 +21061,8 @@ List all user-defined commands, with the first line of the documentation
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for user-defined
+python commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21071,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to user-defined
+python commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21873,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23313,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-14 0:49 [PATCH] Allow user-defined as a category for python gdb macros (resend) Scott Goldman
2012-02-14 3:12 ` Doug Evans
@ 2012-02-14 12:48 ` Phil Muldoon
2012-02-15 9:27 ` Scott Goldman
1 sibling, 1 reply; 24+ messages in thread
From: Phil Muldoon @ 2012-02-14 12:48 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches
On 02/14/2012 12:48 AM, Scott Goldman wrote:
> This patch allows python macros to coexist with legacy gdb macros in
> user-defined category. This way, it's possible to organize your macros
> such that `help user` shows both legacy and python macros. I also
> modified the documentation to use the `user` category in the example
> python macro. It seemed like a more reasonable default category than
> `obscure`.
Thanks.
> 2012-02-13 Scott J. Goldman <scottjg@vmware.com>
>
> * gdb.texinfo: put example python macro in COMMAND_USER category
> rather than COMMAND_OBSCURE.
Documentation entries have their own ChangeLog in doc/. Also, you
should put the node in the () where that change occurs. Also,
ChangeLogs require complete sentences with punctuation/capitalization;
here, and other entries.
> * 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.
Paths have to be complete in ChangeLogs relative to where the
ChangeLog is located, so in this case: python/py-cmd.c
> * top.c (execute_command): only execute a user-defined command as a
> legacy macro if c->user_commands is set.
I think this patch is generally fine, but I think it needs a
test-case. It should be fairly simple to write one. Any new feature,
or regression fix generally requires a test-case to catch any future
regression. This is especially relevant in the Python areas of GDB
which are under constant development.
Cheers,
Phil
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-14 7:57 ` Scott Goldman
@ 2012-02-14 18:09 ` Eli Zaretskii
2012-02-14 20:19 ` Doug Evans
1 sibling, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2012-02-14 18:09 UTC (permalink / raw)
To: Scott Goldman; +Cc: dje, gdb-patches
> From: Scott Goldman <scottjg@vmware.com>
> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
> Date: Mon, 13 Feb 2012 23:57:22 -0800
>
> 2012-02-13 Scott J. Goldman <scottjg@vmware.com>
>
> * gdb.texinfo: put example python macro in COMMAND_USER category
> rather than COMMAND_OBSCURE.
> * gdb.texinfo: update documentation to clarify set/show max-user-call-depth and show user don't apply to
> * python commands.
OK, but please fix the ChangeLog entry as Phil pointed out.
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-14 7:57 ` Scott Goldman
2012-02-14 18:09 ` Eli Zaretskii
@ 2012-02-14 20:19 ` Doug Evans
1 sibling, 0 replies; 24+ messages in thread
From: Doug Evans @ 2012-02-14 20:19 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches
On Mon, Feb 13, 2012 at 11:57 PM, Scott Goldman <scottjg@vmware.com> wrote:
> My only real goal is to be able to have all the user-defined commands listed in one place.
Define "all". :-)
"user-defined" formerly had a very specific meaning, and now it doesn't.
Still, IWBN to be able to put a python-implemented command in
class_user, and list them all.
The documentation needs to make clear that "user" means "those
commands defined in class_user" and not any command defined by the
user.
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-14 12:48 ` Phil Muldoon
@ 2012-02-15 9:27 ` Scott Goldman
2012-02-16 14:23 ` Phil Muldoon
2012-02-23 3:03 ` Doug Evans
0 siblings, 2 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-15 9:27 UTC (permalink / raw)
To: Phil Muldoon, eliz, dje; +Cc: gdb-patches
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.
@kindex show user
@item show user
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for python
+commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21072,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to python
+commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21874,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23314,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index fc7cac0..36fa343 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \
gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
{\['1 2', '3'\]} \
"string_to_argv ('1\\ 2 3')"
+
+# Test user-defined python commands.
+gdb_py_test_multiple "input simple user-defined command" \
+ "python" "" \
+ "class test_help (gdb.Command):" "" \
+ " \"\"\"Docstring\"\"\"" "" \
+ " def __init__ (self):" "" \
+ " super (test_help, self).__init__ (\"test_help\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print \"test_cmd output, arg = %s\" % arg" "" \
+ "test_help ()" "" \
+ "end" ""
+
+gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple user-defined command"
+
+# Make sure the command shows up in `help user-defined`.
+gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" "see user-defined command in `help user-defined`"
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
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
1 sibling, 1 reply; 24+ messages in thread
From: Phil Muldoon @ 2012-02-16 14:23 UTC (permalink / raw)
To: Scott Goldman; +Cc: eliz, dje, gdb-patches
On 02/15/2012 09: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 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
Thanks for taking care of the issues I raised. I have no further comments. Please wait for Doug to give code check-in approval (or more comments), and similarly with Eli with documentation.
Cheers
Phil
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-16 14:23 ` Phil Muldoon
@ 2012-02-16 17:16 ` Eli Zaretskii
0 siblings, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2012-02-16 17:16 UTC (permalink / raw)
To: Phil Muldoon; +Cc: scottjg, dje, gdb-patches
> Date: Thu, 16 Feb 2012 12:44:32 +0000
> From: Phil Muldoon <pmuldoon@redhat.com>
> CC: "eliz@gnu.org" <eliz@gnu.org>, "dje@google.com" <dje@google.com>,
> "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
>
> Thanks for taking care of the issues I raised. I have no further comments. Please wait for Doug to give code check-in approval (or more comments), and similarly with Eli with documentation.
I think I already approved the documentation part.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-15 9:27 ` Scott Goldman
2012-02-16 14:23 ` Phil Muldoon
@ 2012-02-23 3:03 ` Doug Evans
2012-02-23 3:32 ` Scott Goldman
1 sibling, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-02-23 3:03 UTC (permalink / raw)
To: Scott Goldman; +Cc: Phil Muldoon, eliz, gdb-patches
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 3:03 ` Doug Evans
@ 2012-02-23 3:32 ` Scott Goldman
2012-02-23 4:24 ` Eli Zaretskii
2012-02-23 6:03 ` Doug Evans
0 siblings, 2 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-23 3:32 UTC (permalink / raw)
To: Doug Evans; +Cc: Phil Muldoon, eliz, gdb-patches
Hi Doug.
> > @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.
I amended the documentation as per your suggestion. I also added another sentence mentioning that the python docstring would be used for python commands.
Thanks,
-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..aefa003 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21053,15 +21053,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.
+List all user-defined commands and all python commands defined in class COMAND_USER. For user-defined commands, the first line of the documentation
+(if any) is included. For python commands, the python docstring (if any) is included.
@kindex show user
@item show user
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for user-defined
+python commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21071,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to user-defined
+python commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21873,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23313,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index fc7cac0..36fa343 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \
gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
{\['1 2', '3'\]} \
"string_to_argv ('1\\ 2 3')"
+
+# Test user-defined python commands.
+gdb_py_test_multiple "input simple user-defined command" \
+ "python" "" \
+ "class test_help (gdb.Command):" "" \
+ " \"\"\"Docstring\"\"\"" "" \
+ " def __init__ (self):" "" \
+ " super (test_help, self).__init__ (\"test_help\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print \"test_cmd output, arg = %s\" % arg" "" \
+ "test_help ()" "" \
+ "end" ""
+
+gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple user-defined command"
+
+# Make sure the command shows up in `help user-defined`.
+gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" "see user-defined command in `help user-defined`"
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
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
1 sibling, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2012-02-23 4:24 UTC (permalink / raw)
To: Scott Goldman; +Cc: dje, pmuldoon, gdb-patches
> From: 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>
> Date: Wed, 22 Feb 2012 19:02:20 -0800
>
> +List all user-defined commands and all python commands defined in class COMAND_USER. For user-defined commands, the first line of the documentation
> +(if any) is included. For python commands, the python docstring (if any) is included.
Two spaces between sentences, please. And please don't use such long
lines, they make the text harder to read.
OK with those changes.
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 4:24 ` Eli Zaretskii
@ 2012-02-23 5:13 ` Scott Goldman
0 siblings, 0 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-23 5:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: dje, pmuldoon, gdb-patches
Hi Eli.
> Two spaces between sentences, please. And please don't use such long
> lines, they make the text harder to read.
>
> OK with those changes.
done.
thanks,
-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..b4e943f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21053,15 +21053,18 @@ 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.
+List all user-defined commands and all python commands defined in class
+COMAND_USER. For user-defined commands, the first line of the documentation
+(if any) is included. For python commands, the python docstring (if any) is
+included.
@kindex show user
@item show user
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for user-defined
+python commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to user-defined
+python commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21875,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index fc7cac0..36fa343 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \
gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
{\['1 2', '3'\]} \
"string_to_argv ('1\\ 2 3')"
+
+# Test user-defined python commands.
+gdb_py_test_multiple "input simple user-defined command" \
+ "python" "" \
+ "class test_help (gdb.Command):" "" \
+ " \"\"\"Docstring\"\"\"" "" \
+ " def __init__ (self):" "" \
+ " super (test_help, self).__init__ (\"test_help\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print \"test_cmd output, arg = %s\" % arg" "" \
+ "test_help ()" "" \
+ "end" ""
+
+gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple user-defined command"
+
+# Make sure the command shows up in `help user-defined`.
+gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" "see user-defined command in `help user-defined`"
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 3:32 ` Scott Goldman
2012-02-23 4:24 ` Eli Zaretskii
@ 2012-02-23 6:03 ` Doug Evans
2012-02-23 6:56 ` Scott Goldman
1 sibling, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-02-23 6:03 UTC (permalink / raw)
To: Scott Goldman; +Cc: Phil Muldoon, eliz, gdb-patches
On Wed, Feb 22, 2012 at 7:02 PM, Scott Goldman <scottjg@vmware.com> wrote:
> I amended the documentation as per your suggestion. I also added another sentence mentioning that the python docstring would be used for python commands.
>
> [...]
> @kindex help user-defined
> @item help user-defined
> -List all user-defined commands, with the first line of the documentation
> -(if any) for each.
> +List all user-defined commands and all python commands defined in class COMAND_USER. For user-defined commands, the first line of the documentation
> +(if any) is included. For python commands, the python docstring (if any) is included.
Have you tested this? And is the entire docstring printed or just the
first line?
[Guessing, I think it'll be just the first line, in which case I'd
reword that and just say the first line of the documentation or
docstring is included (if any). Or whatever.]
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 6:03 ` Doug Evans
@ 2012-02-23 6:56 ` Scott Goldman
2012-02-23 8:21 ` Scott Goldman
0 siblings, 1 reply; 24+ messages in thread
From: Scott Goldman @ 2012-02-23 6:56 UTC (permalink / raw)
To: Doug Evans; +Cc: Phil Muldoon, eliz, gdb-patches
Hi Doug.
> Have you tested this? And is the entire docstring printed or just the
> first line?
> [Guessing, I think it'll be just the first line, in which case I'd
> reword that and just say the first line of the documentation or
> docstring is included (if any). Or whatever.]
I verified it, and you were right. I adjusted the documentation as per your suggestion. All the python commands we're using currently have one line docstrings, so it didn't even occur to me.
thanks,
-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..eee343a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21053,15 +21053,18 @@ 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.
+List all user-defined commands and all python commands defined in class
+COMAND_USER. For user-defined commands, the first line of the documentation
+(if any) is included. For python commands, the first line of the python
+docstring (if any) is included.
@kindex show user
@item show user
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for user-defined
+python commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to user-defined
+python commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21875,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index fc7cac0..36fa343 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \
gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
{\['1 2', '3'\]} \
"string_to_argv ('1\\ 2 3')"
+
+# Test user-defined python commands.
+gdb_py_test_multiple "input simple user-defined command" \
+ "python" "" \
+ "class test_help (gdb.Command):" "" \
+ " \"\"\"Docstring\"\"\"" "" \
+ " def __init__ (self):" "" \
+ " super (test_help, self).__init__ (\"test_help\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print \"test_cmd output, arg = %s\" % arg" "" \
+ "test_help ()" "" \
+ "end" ""
+
+gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple user-defined command"
+
+# Make sure the command shows up in `help user-defined`.
+gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" "see user-defined command in `help user-defined`"
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 6:56 ` Scott Goldman
@ 2012-02-23 8:21 ` Scott Goldman
2012-02-24 23:49 ` Scott Goldman
0 siblings, 1 reply; 24+ messages in thread
From: Scott Goldman @ 2012-02-23 8:21 UTC (permalink / raw)
To: Doug Evans; +Cc: Phil Muldoon, eliz, gdb-patches
> Hi Doug.
>
>> Have you tested this? And is the entire docstring printed or just the
>> first line?
>> [Guessing, I think it'll be just the first line, in which case I'd
>> reword that and just say the first line of the documentation or
>> docstring is included (if any). Or whatever.]
>
> I verified it, and you were right. I adjusted the documentation as per your suggestion. All the python commands we're using currently have one line docstrings, so it didn't even occur to me.
Err.. on second thought, I like Doug's wording better.
thanks,
-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..eee343a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21053,15 +21053,18 @@ 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.
+List all user-defined commands and all python commands defined in class
+COMAND_USER. The first line of the documentation or docstring is
+included (if any).
@kindex show user
@item show user
@itemx show user @var{commandname}
Display the @value{GDBN} commands used to define @var{commandname} (but
not its documentation). If no @var{commandname} is given, display the
-definitions for all user-defined commands.
+definitions for all user-defined commands. This does not work for user-defined
+python commands.
@cindex infinite recursion in user-defined commands
@kindex show max-user-call-depth
@@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
@itemx set max-user-call-depth
The value of @code{max-user-call-depth} controls how many recursion
levels are allowed in user-defined commands before @value{GDBN} suspects an
-infinite recursion and aborts the command.
+infinite recursion and aborts the command. This does not apply to user-defined
+python commands.
@end table
In addition to the above commands, user-defined commands frequently
@@ -21871,7 +21875,7 @@ to handle this case. Example:
>class HelloWorld (gdb.Command):
> """Greet the whole world."""
> def __init__ (self):
-> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+> super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
> def invoke (self, args, from_tty):
> argv = gdb.string_to_argv (args)
> if len (argv) != 0:
@@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
- super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)
+ super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index aad1ab4..04476db 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
&& cmdtype != class_files && cmdtype != class_support
&& cmdtype != class_info && cmdtype != class_breakpoint
&& cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ && cmdtype != class_maintenance && cmdtype != class_user)
{
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
class_obscure) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0)
+ class_maintenance) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
return;
for (i = 0; i < N_COMPLETERS; ++i)
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index fc7cac0..36fa343 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \
gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
{\['1 2', '3'\]} \
"string_to_argv ('1\\ 2 3')"
+
+# Test user-defined python commands.
+gdb_py_test_multiple "input simple user-defined command" \
+ "python" "" \
+ "class test_help (gdb.Command):" "" \
+ " \"\"\"Docstring\"\"\"" "" \
+ " def __init__ (self):" "" \
+ " super (test_help, self).__init__ (\"test_help\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print \"test_cmd output, arg = %s\" % arg" "" \
+ "test_help ()" "" \
+ "end" ""
+
+gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple user-defined command"
+
+# Make sure the command shows up in `help user-defined`.
+gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" "see user-defined command in `help user-defined`"
diff --git a/gdb/top.c b/gdb/top.c
index e41f56c..e73a772 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
if (c->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line);
- if (c->class == class_user)
+ /* c->user_commands would be NULL in the case of a python command. */
+ if (c->class == class_user && c->user_commands)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-23 8:21 ` Scott Goldman
@ 2012-02-24 23:49 ` Scott Goldman
2012-02-28 1:36 ` Doug Evans
` (2 more replies)
0 siblings, 3 replies; 24+ messages in thread
From: Scott Goldman @ 2012-02-24 23:49 UTC (permalink / raw)
To: gdb-patches; +Cc: Phil Muldoon, eliz, Doug Evans
Ping.
I think all the reviewers (Phil, Doug, Eli) were ok with this most recent revision based on the comments. I would be happy to do further cleanup if necessary. Otherwise, could this committed whenever someone gets a chance?
thanks!
-sjg
> -----Original Message-----
> From: Scott Goldman
> Sent: Wednesday, February 22, 2012 11:52 PM
> To: Doug Evans
> Cc: Phil Muldoon; eliz@gnu.org; gdb-patches@sourceware.org
> Subject: RE: [PATCH] Allow user-defined as a category for python gdb
> macros (resend)
>
> > Hi Doug.
> >
> >> Have you tested this? And is the entire docstring printed or just
> the
> >> first line?
> >> [Guessing, I think it'll be just the first line, in which case I'd
> >> reword that and just say the first line of the documentation or
> >> docstring is included (if any). Or whatever.]
> >
> > I verified it, and you were right. I adjusted the documentation as
> per your suggestion. All the python commands we're using currently have
> one line docstrings, so it didn't even occur to me.
>
> Err.. on second thought, I like Doug's wording better.
>
> thanks,
> -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..eee343a 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -21053,15 +21053,18 @@ 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.
> +List all user-defined commands and all python commands defined in
> class
> +COMAND_USER. The first line of the documentation or docstring is
> +included (if any).
>
> @kindex show user
> @item show user
> @itemx show user @var{commandname}
> Display the @value{GDBN} commands used to define @var{commandname}
> (but
> not its documentation). If no @var{commandname} is given, display the
> -definitions for all user-defined commands.
> +definitions for all user-defined commands. This does not work for
> user-defined
> +python commands.
>
> @cindex infinite recursion in user-defined commands
> @kindex show max-user-call-depth
> @@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
> @itemx set max-user-call-depth
> The value of @code{max-user-call-depth} controls how many recursion
> levels are allowed in user-defined commands before @value{GDBN}
> suspects an
> -infinite recursion and aborts the command.
> +infinite recursion and aborts the command. This does not apply to
> user-defined
> +python commands.
> @end table
>
> In addition to the above commands, user-defined commands frequently
> @@ -21871,7 +21875,7 @@ to handle this case. Example:
> >class HelloWorld (gdb.Command):
> > """Greet the whole world."""
> > def __init__ (self):
> -> super (HelloWorld, self).__init__ ("hello-world",
> gdb.COMMAND_OBSCURE)
> +> super (HelloWorld, self).__init__ ("hello-world",
> gdb.COMMAND_USER)
> > def invoke (self, args, from_tty):
> > argv = gdb.string_to_argv (args)
> > if len (argv) != 0:
> @@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
> """Greet the whole world."""
>
> def __init__ (self):
> - super (HelloWorld, self).__init__ ("hello-world",
> gdb.COMMAND_OBSCURE)
> + super (HelloWorld, self).__init__ ("hello-world",
> gdb.COMMAND_USER)
>
> def invoke (self, arg, from_tty):
> print "Hello, World!"
> diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
> index aad1ab4..04476db 100644
> --- a/gdb/python/py-cmd.c
> +++ b/gdb/python/py-cmd.c
> @@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args,
> PyObject *kw)
> && cmdtype != class_files && cmdtype != class_support
> && cmdtype != class_info && cmdtype != class_breakpoint
> && cmdtype != class_trace && cmdtype != class_obscure
> - && cmdtype != class_maintenance)
> + && cmdtype != class_maintenance && cmdtype != class_user)
> {
> PyErr_Format (PyExc_RuntimeError, _("Invalid command class
> argument."));
> return -1;
> @@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
> || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
> class_obscure) < 0
> || PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
> - class_maintenance) < 0)
> + class_maintenance) < 0
> + || PyModule_AddIntConstant (gdb_module, "COMMAND_USER",
> class_user) < 0)
> return;
>
> for (i = 0; i < N_COMPLETERS; ++i)
> diff --git a/gdb/testsuite/gdb.python/py-cmd.exp
> b/gdb/testsuite/gdb.python/py-cmd.exp
> index fc7cac0..36fa343 100644
> --- a/gdb/testsuite/gdb.python/py-cmd.exp
> +++ b/gdb/testsuite/gdb.python/py-cmd.exp
> @@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1
> 2\" 3')" \
> gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
> {\['1 2', '3'\]} \
> "string_to_argv ('1\\ 2 3')"
> +
> +# Test user-defined python commands.
> +gdb_py_test_multiple "input simple user-defined command" \
> + "python" "" \
> + "class test_help (gdb.Command):" "" \
> + " \"\"\"Docstring\"\"\"" "" \
> + " def __init__ (self):" "" \
> + " super (test_help, self).__init__ (\"test_help\",
> gdb.COMMAND_USER)" "" \
> + " def invoke (self, arg, from_tty):" "" \
> + " print \"test_cmd output, arg = %s\" % arg" "" \
> + "test_help ()" "" \
> + "end" ""
> +
> +gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple
> user-defined command"
> +
> +# Make sure the command shows up in `help user-defined`.
> +gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The
> commands in this class are those defined by the user.\[\r\n\]+Use the
> \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of
> commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type
> \"help\" followed by command name for full documentation.\[\r\n\]+Type
> \"apropos word\" to search for commands related to
> \"word\".\[\r\n\]+Command name abbreviations are allowed if
> unambiguous.\[\r\n\]+" "see user-defined command in `help user-
> defined`"
> diff --git a/gdb/top.c b/gdb/top.c
> index e41f56c..e73a772 100644
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
> if (c->flags & DEPRECATED_WARN_USER)
> deprecated_cmd_warning (&line);
>
> - if (c->class == class_user)
> + /* c->user_commands would be NULL in the case of a python
> command. */
> + if (c->class == class_user && c->user_commands)
> execute_user_command (c, arg);
> else if (c->type == set_cmd || c->type == show_cmd)
> do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-24 23:49 ` Scott Goldman
@ 2012-02-28 1:36 ` Doug Evans
2012-02-28 4:18 ` Scott Goldman
2012-02-29 0:45 ` [doc RFA] " Doug Evans
2012-03-01 19:31 ` Doug Evans
2 siblings, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-02-28 1:36 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches, Phil Muldoon, eliz
Hi.
I'm happy to check it in for you.
Doing a final sanity check, there doesn't seem to be a copyright
assignment on file (in the place where gdb developers look to confirm
such things).
[Presumably it's cleared, but just hasn't been recorded yet.]
Can you double check to make sure the copyright assignment has gone through.
Thanks!
[And sorry for the trouble.]
On Fri, Feb 24, 2012 at 3:22 PM, Scott Goldman <scottjg@vmware.com> wrote:
> Ping.
>
> I think all the reviewers (Phil, Doug, Eli) were ok with this most recent revision based on the comments. I would be happy to do further cleanup if necessary. Otherwise, could this committed whenever someone gets a chance?
>
> thanks!
> -sjg
>
>> -----Original Message-----
>> From: Scott Goldman
>> Sent: Wednesday, February 22, 2012 11:52 PM
>> To: Doug Evans
>> Cc: Phil Muldoon; eliz@gnu.org; gdb-patches@sourceware.org
>> Subject: RE: [PATCH] Allow user-defined as a category for python gdb
>> macros (resend)
>>
>> > Hi Doug.
>> >
>> >> Have you tested this? And is the entire docstring printed or just
>> the
>> >> first line?
>> >> [Guessing, I think it'll be just the first line, in which case I'd
>> >> reword that and just say the first line of the documentation or
>> >> docstring is included (if any). Or whatever.]
>> >
>> > I verified it, and you were right. I adjusted the documentation as
>> per your suggestion. All the python commands we're using currently have
>> one line docstrings, so it didn't even occur to me.
>>
>> Err.. on second thought, I like Doug's wording better.
>>
>> thanks,
>> -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..eee343a 100644
>> --- a/gdb/doc/gdb.texinfo
>> +++ b/gdb/doc/gdb.texinfo
>> @@ -21053,15 +21053,18 @@ 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.
>> +List all user-defined commands and all python commands defined in
>> class
>> +COMAND_USER. The first line of the documentation or docstring is
>> +included (if any).
>>
>> @kindex show user
>> @item show user
>> @itemx show user @var{commandname}
>> Display the @value{GDBN} commands used to define @var{commandname}
>> (but
>> not its documentation). If no @var{commandname} is given, display the
>> -definitions for all user-defined commands.
>> +definitions for all user-defined commands. This does not work for
>> user-defined
>> +python commands.
>>
>> @cindex infinite recursion in user-defined commands
>> @kindex show max-user-call-depth
>> @@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
>> @itemx set max-user-call-depth
>> The value of @code{max-user-call-depth} controls how many recursion
>> levels are allowed in user-defined commands before @value{GDBN}
>> suspects an
>> -infinite recursion and aborts the command.
>> +infinite recursion and aborts the command. This does not apply to
>> user-defined
>> +python commands.
>> @end table
>>
>> In addition to the above commands, user-defined commands frequently
>> @@ -21871,7 +21875,7 @@ to handle this case. Example:
>> >class HelloWorld (gdb.Command):
>> > """Greet the whole world."""
>> > def __init__ (self):
>> -> super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_OBSCURE)
>> +> super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_USER)
>> > def invoke (self, args, from_tty):
>> > argv = gdb.string_to_argv (args)
>> > if len (argv) != 0:
>> @@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
>> """Greet the whole world."""
>>
>> def __init__ (self):
>> - super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_OBSCURE)
>> + super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_USER)
>>
>> def invoke (self, arg, from_tty):
>> print "Hello, World!"
>> diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
>> index aad1ab4..04476db 100644
>> --- a/gdb/python/py-cmd.c
>> +++ b/gdb/python/py-cmd.c
>> @@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args,
>> PyObject *kw)
>> && cmdtype != class_files && cmdtype != class_support
>> && cmdtype != class_info && cmdtype != class_breakpoint
>> && cmdtype != class_trace && cmdtype != class_obscure
>> - && cmdtype != class_maintenance)
>> + && cmdtype != class_maintenance && cmdtype != class_user)
>> {
>> PyErr_Format (PyExc_RuntimeError, _("Invalid command class
>> argument."));
>> return -1;
>> @@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
>> || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
>> class_obscure) < 0
>> || PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
>> - class_maintenance) < 0)
>> + class_maintenance) < 0
>> + || PyModule_AddIntConstant (gdb_module, "COMMAND_USER",
>> class_user) < 0)
>> return;
>>
>> for (i = 0; i < N_COMPLETERS; ++i)
>> diff --git a/gdb/testsuite/gdb.python/py-cmd.exp
>> b/gdb/testsuite/gdb.python/py-cmd.exp
>> index fc7cac0..36fa343 100644
>> --- a/gdb/testsuite/gdb.python/py-cmd.exp
>> +++ b/gdb/testsuite/gdb.python/py-cmd.exp
>> @@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1
>> 2\" 3')" \
>> gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
>> {\['1 2', '3'\]} \
>> "string_to_argv ('1\\ 2 3')"
>> +
>> +# Test user-defined python commands.
>> +gdb_py_test_multiple "input simple user-defined command" \
>> + "python" "" \
>> + "class test_help (gdb.Command):" "" \
>> + " \"\"\"Docstring\"\"\"" "" \
>> + " def __init__ (self):" "" \
>> + " super (test_help, self).__init__ (\"test_help\",
>> gdb.COMMAND_USER)" "" \
>> + " def invoke (self, arg, from_tty):" "" \
>> + " print \"test_cmd output, arg = %s\" % arg" "" \
>> + "test_help ()" "" \
>> + "end" ""
>> +
>> +gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple
>> user-defined command"
>> +
>> +# Make sure the command shows up in `help user-defined`.
>> +gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The
>> commands in this class are those defined by the user.\[\r\n\]+Use the
>> \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of
>> commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type
>> \"help\" followed by command name for full documentation.\[\r\n\]+Type
>> \"apropos word\" to search for commands related to
>> \"word\".\[\r\n\]+Command name abbreviations are allowed if
>> unambiguous.\[\r\n\]+" "see user-defined command in `help user-
>> defined`"
>> diff --git a/gdb/top.c b/gdb/top.c
>> index e41f56c..e73a772 100644
>> --- a/gdb/top.c
>> +++ b/gdb/top.c
>> @@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
>> if (c->flags & DEPRECATED_WARN_USER)
>> deprecated_cmd_warning (&line);
>>
>> - if (c->class == class_user)
>> + /* c->user_commands would be NULL in the case of a python
>> command. */
>> + if (c->class == class_user && c->user_commands)
>> execute_user_command (c, arg);
>> else if (c->type == set_cmd || c->type == show_cmd)
>> do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-28 1:36 ` Doug Evans
@ 2012-02-28 4:18 ` Scott Goldman
2012-02-28 7:51 ` Doug Evans
0 siblings, 1 reply; 24+ messages in thread
From: Scott Goldman @ 2012-02-28 4:18 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches, Phil Muldoon, eliz, copyright-clerk
Hi Doug.
> I'm happy to check it in for you.
> Doing a final sanity check, there doesn't seem to be a copyright
> assignment on file (in the place where gdb developers look to confirm
> such things).
> [Presumably it's cleared, but just hasn't been recorded yet.]
> Can you double check to make sure the copyright assignment has gone
> through.
> Thanks!
> [And sorry for the trouble.]
My understanding is that VMware had some sort of issue with the assignment paperwork, but made an agreement with the FSF to release this patch in the public domain. Donald Robertson, one of the lawyers at the FSF, OK'ed this.
I cc'ed the contact email I have for the fsf copyright assignment folks for Donald to confirm.
-sjg
> -----Original Message-----
> From: Donald R Robertson III via RT [mailto:______@fsf.org]
> Sent: Wednesday, November 09, 2011 7:27 AM
> To: Krystia Przepiorski; Scott Goldman
> Subject: [gnu.org #697202] copyright assignment form request for Scott
> J. Goldman
>
> > [_______@vmware.com - Tue Nov 08 17:55:49 2011]:
> >
> > Donald - Sorry for the delay.
> >
> > Would it be acceptable to the FSF if VMware marked/released our
> > contribution to the public domain when sending to you?
> >
> > Given that this is only 3-4 lines of code it is likely not worth
> digging
> > into modifying the Assignment Agreement.
>
> Ah, yes, there's no need for assignment in this situation. Thank you so
> much for your time.
>
> >
> > Thanks,
> > Krystia
> >
> >
> >
> > Krystia Przepiorski | Associate Corporate Counsel | VMware, Inc. |
> 3401
> > Hillview Avenue, Palo Alto, CA 94304
> >
> >
> >
> >
> >
> > On 11/1/11 8:16 AM, "Donald R Robertson III via RT"
> > <_______@fsf.org> wrote:
> >
> > >Hello again,
> > >
> > >I just wanted to check in on this issue. Were there any questions
> about
> > >our standard assignment
> > >form? Thank you so much for your time, and I hope to hear from you
> soon.
> > >
> > >--
> > >Sincerely,
> > >
> > >Donald R. Robertson, III, J.D.
> > >Assignment Administrator
> > >Free Software Foundation
> > >51 Franklin Street, Fifth Floor
> > >Boston, MA 02110
> > >
> > >---
> > >
> >
> >
> >
> >
> --
> Sincerely,
>
> Donald R. Robertson, III, J.D.
> Assignment Administrator
> Free Software Foundation
> 51 Franklin Street, Fifth Floor
> Boston, MA 02110
>
> ---
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-28 4:18 ` Scott Goldman
@ 2012-02-28 7:51 ` Doug Evans
0 siblings, 0 replies; 24+ messages in thread
From: Doug Evans @ 2012-02-28 7:51 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches, Phil Muldoon, eliz, copyright-clerk
Ah. If the patch falls under the "no assignment needed" rule, awesome.
It is a (relatively) small patch, but I'm a bit shy at making such
calls (beyond the trivial cases).
On Mon, Feb 27, 2012 at 5:36 PM, Scott Goldman <scottjg@vmware.com> wrote:
> Hi Doug.
>
>> I'm happy to check it in for you.
>> Doing a final sanity check, there doesn't seem to be a copyright
>> assignment on file (in the place where gdb developers look to confirm
>> such things).
>> [Presumably it's cleared, but just hasn't been recorded yet.]
>> Can you double check to make sure the copyright assignment has gone
>> through.
>> Thanks!
>> [And sorry for the trouble.]
>
> My understanding is that VMware had some sort of issue with the assignment paperwork, but made an agreement with the FSF to release this patch in the public domain. Donald Robertson, one of the lawyers at the FSF, OK'ed this.
>
> I cc'ed the contact email I have for the fsf copyright assignment folks for Donald to confirm.
>
> -sjg
>
>
>> -----Original Message-----
>> From: Donald R Robertson III via RT [mailto:______@fsf.org]
>> Sent: Wednesday, November 09, 2011 7:27 AM
>> To: Krystia Przepiorski; Scott Goldman
>> Subject: [gnu.org #697202] copyright assignment form request for Scott
>> J. Goldman
>>
>> > [_______@vmware.com - Tue Nov 08 17:55:49 2011]:
>> >
>> > Donald - Sorry for the delay.
>> >
>> > Would it be acceptable to the FSF if VMware marked/released our
>> > contribution to the public domain when sending to you?
>> >
>> > Given that this is only 3-4 lines of code it is likely not worth
>> digging
>> > into modifying the Assignment Agreement.
>>
>> Ah, yes, there's no need for assignment in this situation. Thank you so
>> much for your time.
>>
>> >
>> > Thanks,
>> > Krystia
>> >
>> >
>> >
>> > Krystia Przepiorski | Associate Corporate Counsel | VMware, Inc. |
>> 3401
>> > Hillview Avenue, Palo Alto, CA 94304
>> >
>> >
>> >
>> >
>> >
>> > On 11/1/11 8:16 AM, "Donald R Robertson III via RT"
>> > <_______@fsf.org> wrote:
>> >
>> > >Hello again,
>> > >
>> > >I just wanted to check in on this issue. Were there any questions
>> about
>> > >our standard assignment
>> > >form? Thank you so much for your time, and I hope to hear from you
>> soon.
>> > >
>> > >--
>> > >Sincerely,
>> > >
>> > >Donald R. Robertson, III, J.D.
>> > >Assignment Administrator
>> > >Free Software Foundation
>> > >51 Franklin Street, Fifth Floor
>> > >Boston, MA 02110
>> > >
>> > >---
>> > >
>> >
>> >
>> >
>> >
>> --
>> Sincerely,
>>
>> Donald R. Robertson, III, J.D.
>> Assignment Administrator
>> Free Software Foundation
>> 51 Franklin Street, Fifth Floor
>> Boston, MA 02110
>>
>> ---
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* [doc RFA] Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-24 23:49 ` Scott Goldman
2012-02-28 1:36 ` Doug Evans
@ 2012-02-29 0:45 ` Doug Evans
2012-02-29 4:17 ` Eli Zaretskii
2012-03-01 19:31 ` Doug Evans
2 siblings, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-02-29 0:45 UTC (permalink / raw)
To: Scott Goldman, Eli Zaretskii; +Cc: gdb-patches, Phil Muldoon
On Fri, Feb 24, 2012 at 3:22 PM, Scott Goldman <scottjg@vmware.com> wrote:
> Ping.
>
> I think all the reviewers (Phil, Doug, Eli) were ok with this most recent revision based on the comments. I would be happy to do further cleanup if necessary. Otherwise, could this committed whenever someone gets a chance?
Hi.
I was about to check this in (after fixing a few whitespace issues),
and noticed a missing bit of doc.
Eli, ok to check in?
2012-02-28 Doug Evans <dje@google.com>
* NEWS: Mention new python command class gdb.COMMAND_USER.
doc/
* gdb.texinfo (Commands In Python): Document gdb.COMMAND_USER.
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.490
diff -u -p -r1.490 NEWS
--- NEWS 24 Feb 2012 15:04:58 -0000 1.490
+++ NEWS 28 Feb 2012 23:24:59 -0000
@@ -5,6 +5,9 @@
* Python scripting
+ ** GDB commands implemented in Python can now be put in command class
+ "gdb.COMMAND_USER".
+
** The "maint set python print-stack on|off" is now deleted.
** A new class, gdb.printing.FlagEnumerationPrinter, can be used to
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.926
diff -u -p -r1.926 gdb.texinfo
--- doc/gdb.texinfo 25 Feb 2012 13:54:25 -0000 1.926
+++ doc/gdb.texinfo 28 Feb 2012 23:25:01 -0000
@@ -23330,6 +23333,15 @@ The command has to do with tracepoints.
@kbd{help tracepoints} at the @value{GDBN} prompt to see a list of
commands in this category.
+@findex COMMAND_USER
+@findex gdb.COMMAND_USER
+@item gdb.COMMAND_USER
+The command is a general purpose command for the user, and typically
+does not fit in one of the other categories.
+Type @kbd{help user-defined} at the @value{GDBN} prompt to see
+a list of commands in this category, as well as the list of gdb macros
+(@pxref{Sequences}).
+
@findex COMMAND_OBSCURE
@findex gdb.COMMAND_OBSCURE
@item gdb.COMMAND_OBSCURE
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [doc RFA] Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-29 0:45 ` [doc RFA] " Doug Evans
@ 2012-02-29 4:17 ` Eli Zaretskii
0 siblings, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2012-02-29 4:17 UTC (permalink / raw)
To: Doug Evans; +Cc: scottjg, gdb-patches, pmuldoon
> Date: Tue, 28 Feb 2012 15:27:33 -0800
> From: Doug Evans <dje@google.com>
> Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>, Phil Muldoon <pmuldoon@redhat.com>
>
> I was about to check this in (after fixing a few whitespace issues),
> and noticed a missing bit of doc.
>
> Eli, ok to check in?
Yes, thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-02-24 23:49 ` Scott Goldman
2012-02-28 1:36 ` Doug Evans
2012-02-29 0:45 ` [doc RFA] " Doug Evans
@ 2012-03-01 19:31 ` Doug Evans
2012-03-01 20:26 ` Keith Seitz
2 siblings, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-03-01 19:31 UTC (permalink / raw)
To: Scott Goldman; +Cc: gdb-patches, Phil Muldoon, eliz
Hi.
Committed.
On Fri, Feb 24, 2012 at 3:22 PM, Scott Goldman <scottjg@vmware.com> wrote:
> Ping.
>
> I think all the reviewers (Phil, Doug, Eli) were ok with this most recent revision based on the comments. I would be happy to do further cleanup if necessary. Otherwise, could this committed whenever someone gets a chance?
>
> thanks!
> -sjg
>
>> -----Original Message-----
>> From: Scott Goldman
>> Sent: Wednesday, February 22, 2012 11:52 PM
>> To: Doug Evans
>> Cc: Phil Muldoon; eliz@gnu.org; gdb-patches@sourceware.org
>> Subject: RE: [PATCH] Allow user-defined as a category for python gdb
>> macros (resend)
>>
>> > Hi Doug.
>> >
>> >> Have you tested this? And is the entire docstring printed or just
>> the
>> >> first line?
>> >> [Guessing, I think it'll be just the first line, in which case I'd
>> >> reword that and just say the first line of the documentation or
>> >> docstring is included (if any). Or whatever.]
>> >
>> > I verified it, and you were right. I adjusted the documentation as
>> per your suggestion. All the python commands we're using currently have
>> one line docstrings, so it didn't even occur to me.
>>
>> Err.. on second thought, I like Doug's wording better.
>>
>> thanks,
>> -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..eee343a 100644
>> --- a/gdb/doc/gdb.texinfo
>> +++ b/gdb/doc/gdb.texinfo
>> @@ -21053,15 +21053,18 @@ 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.
>> +List all user-defined commands and all python commands defined in
>> class
>> +COMAND_USER. The first line of the documentation or docstring is
>> +included (if any).
>>
>> @kindex show user
>> @item show user
>> @itemx show user @var{commandname}
>> Display the @value{GDBN} commands used to define @var{commandname}
>> (but
>> not its documentation). If no @var{commandname} is given, display the
>> -definitions for all user-defined commands.
>> +definitions for all user-defined commands. This does not work for
>> user-defined
>> +python commands.
>>
>> @cindex infinite recursion in user-defined commands
>> @kindex show max-user-call-depth
>> @@ -21070,7 +21073,8 @@ definitions for all user-defined commands.
>> @itemx set max-user-call-depth
>> The value of @code{max-user-call-depth} controls how many recursion
>> levels are allowed in user-defined commands before @value{GDBN}
>> suspects an
>> -infinite recursion and aborts the command.
>> +infinite recursion and aborts the command. This does not apply to
>> user-defined
>> +python commands.
>> @end table
>>
>> In addition to the above commands, user-defined commands frequently
>> @@ -21871,7 +21875,7 @@ to handle this case. Example:
>> >class HelloWorld (gdb.Command):
>> > """Greet the whole world."""
>> > def __init__ (self):
>> -> super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_OBSCURE)
>> +> super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_USER)
>> > def invoke (self, args, from_tty):
>> > argv = gdb.string_to_argv (args)
>> > if len (argv) != 0:
>> @@ -23311,7 +23315,7 @@ class HelloWorld (gdb.Command):
>> """Greet the whole world."""
>>
>> def __init__ (self):
>> - super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_OBSCURE)
>> + super (HelloWorld, self).__init__ ("hello-world",
>> gdb.COMMAND_USER)
>>
>> def invoke (self, arg, from_tty):
>> print "Hello, World!"
>> diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
>> index aad1ab4..04476db 100644
>> --- a/gdb/python/py-cmd.c
>> +++ b/gdb/python/py-cmd.c
>> @@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args,
>> PyObject *kw)
>> && cmdtype != class_files && cmdtype != class_support
>> && cmdtype != class_info && cmdtype != class_breakpoint
>> && cmdtype != class_trace && cmdtype != class_obscure
>> - && cmdtype != class_maintenance)
>> + && cmdtype != class_maintenance && cmdtype != class_user)
>> {
>> PyErr_Format (PyExc_RuntimeError, _("Invalid command class
>> argument."));
>> return -1;
>> @@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
>> || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
>> class_obscure) < 0
>> || PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
>> - class_maintenance) < 0)
>> + class_maintenance) < 0
>> + || PyModule_AddIntConstant (gdb_module, "COMMAND_USER",
>> class_user) < 0)
>> return;
>>
>> for (i = 0; i < N_COMPLETERS; ++i)
>> diff --git a/gdb/testsuite/gdb.python/py-cmd.exp
>> b/gdb/testsuite/gdb.python/py-cmd.exp
>> index fc7cac0..36fa343 100644
>> --- a/gdb/testsuite/gdb.python/py-cmd.exp
>> +++ b/gdb/testsuite/gdb.python/py-cmd.exp
>> @@ -138,3 +138,20 @@ gdb_test "python print gdb.string_to_argv ('\"1
>> 2\" 3')" \
>> gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \
>> {\['1 2', '3'\]} \
>> "string_to_argv ('1\\ 2 3')"
>> +
>> +# Test user-defined python commands.
>> +gdb_py_test_multiple "input simple user-defined command" \
>> + "python" "" \
>> + "class test_help (gdb.Command):" "" \
>> + " \"\"\"Docstring\"\"\"" "" \
>> + " def __init__ (self):" "" \
>> + " super (test_help, self).__init__ (\"test_help\",
>> gdb.COMMAND_USER)" "" \
>> + " def invoke (self, arg, from_tty):" "" \
>> + " print \"test_cmd output, arg = %s\" % arg" "" \
>> + "test_help ()" "" \
>> + "end" ""
>> +
>> +gdb_test "test_help ugh" "test_cmd output, arg = ugh" "call simple
>> user-defined command"
>> +
>> +# Make sure the command shows up in `help user-defined`.
>> +gdb_test "help user-defined" "User-defined commands.\[\r\n\]+The
>> commands in this class are those defined by the user.\[\r\n\]+Use the
>> \"define\" command to define a command.\[\r\n\]+\[\r\n\]+List of
>> commands:\[\r\n\]+\[\r\n\]+test_help -- Docstring\[\r\n\]+\[\r\n\]+Type
>> \"help\" followed by command name for full documentation.\[\r\n\]+Type
>> \"apropos word\" to search for commands related to
>> \"word\".\[\r\n\]+Command name abbreviations are allowed if
>> unambiguous.\[\r\n\]+" "see user-defined command in `help user-
>> defined`"
>> diff --git a/gdb/top.c b/gdb/top.c
>> index e41f56c..e73a772 100644
>> --- a/gdb/top.c
>> +++ b/gdb/top.c
>> @@ -470,7 +470,8 @@ execute_command (char *p, int from_tty)
>> if (c->flags & DEPRECATED_WARN_USER)
>> deprecated_cmd_warning (&line);
>>
>> - if (c->class == class_user)
>> + /* c->user_commands would be NULL in the case of a python
>> command. */
>> + if (c->class == class_user && c->user_commands)
>> execute_user_command (c, arg);
>> else if (c->type == set_cmd || c->type == show_cmd)
>> do_setshow_command (arg, from_tty, c);
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)
2012-03-01 19:31 ` Doug Evans
@ 2012-03-01 20:26 ` Keith Seitz
0 siblings, 0 replies; 24+ messages in thread
From: Keith Seitz @ 2012-03-01 20:26 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
On 03/01/2012 11:31 AM, Doug Evans wrote:
> Hi.
> Committed.
I've committed the attached patch, which updates the doc string modified
by this patch:
>>> @@ -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,
This regresses a test in help.exp.
Keith
ChangeLog
2012-03-01 Keith Seitz <keiths@redhat.com>
* gdb.base/help.exp (help show user): Update expected result
for new doc string changes (add "non-python").
[-- Attachment #2: help.exp.patch --]
[-- Type: text/x-patch, Size: 1214 bytes --]
Index: testsuite/gdb.base/help.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/help.exp,v
retrieving revision 1.55
diff -u -p -r1.55 help.exp
--- testsuite/gdb.base/help.exp 24 Jan 2012 15:13:30 -0000 1.55
+++ testsuite/gdb.base/help.exp 1 Mar 2012 20:23:41 -0000
@@ -574,7 +574,7 @@ gdb_test "help show radix" "Show the def
# test help show symbol-reloading
gdb_test "help show symbol-reloading" "Show dynamic symbol table reloading multiple times in one run\." "help show symbol-reloading"
# test help show user
-gdb_test "help show user" "Show definitions of user defined commands\.\[\r\n\]+Argument is the name of the user defined command\.\[\r\n\]+With no argument, show definitions of all user defined commands\." "help show user"
+gdb_test "help show user" "Show definitions of non-python user defined commands\.\[\r\n\]+Argument is the name of the user defined command\.\[\r\n\]+With no argument, show definitions of all user defined commands\." "help show user"
# test help show values
gdb_test "help show values" "Elements of value history around item number IDX \\(or last ten\\)\." "help show values"
# test help show verbose
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2012-03-01 20:26 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-14 0:49 [PATCH] Allow user-defined as a category for python gdb macros (resend) 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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox