From 7d74f2446c5ebad93f62426e285b64de882db843 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 1 Mar 2012 19:30:25 +0000 Subject: * NEWS: Mention new python command class gdb.COMMAND_USER. * 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. doc/ * gdb.texinfo (Commands In Python): Put example python macro in COMMAND_USER category rather than COMMAND_OBSCURE. Document gdb.COMMAND_USER. (User-defined Commands): Update documentation to clarify "set/show max-user-call-depth" and "show user" don't apply to python commands. Update documentation to clarify "help user-defined" may also include python commands defined as COMMAND_USER. testsuite/ * 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". --- gdb/doc/ChangeLog | 10 ++++++++++ gdb/doc/gdb.texinfo | 20 ++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 59bb285..18f47bd 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,13 @@ +2012-03-01 Scott J. Goldman + + * gdb.texinfo (Commands In Python): Put example python macro in + COMMAND_USER category rather than COMMAND_OBSCURE. + Document gdb.COMMAND_USER. + (User-defined Commands): Update documentation to clarify + "set/show max-user-call-depth" and "show user" don't apply to python + commands. Update documentation to clarify "help user-defined" may + also include python commands defined as COMMAND_USER. + 2012-02-25 Jan Kratochvil * gdb.texinfo (Startup): Add option -ex description to the option -x diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 88dcec1..6fd6158 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -21133,8 +21133,9 @@ 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 @@ -21142,6 +21143,7 @@ List all user-defined commands, with the first line of the documentation 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. +This does not work for user-defined python commands. @cindex infinite recursion in user-defined commands @kindex show max-user-call-depth @@ -21151,6 +21153,7 @@ definitions for all user-defined commands. 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. +This does not apply to user-defined python commands. @end table In addition to the above commands, user-defined commands frequently @@ -21951,7 +21954,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: @@ -23330,6 +23333,15 @@ The command has to do with tracepoints. For example, @code{trace}, @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 @@ -23391,7 +23403,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!" -- cgit v1.1