aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-03-01 19:30:25 +0000
committerDoug Evans <dje@google.com>2012-03-01 19:30:25 +0000
commit7d74f2446c5ebad93f62426e285b64de882db843 (patch)
treeb3bae2bccf6b51d2496c706ee1fb68911c000e0c /gdb/cli/cli-cmds.c
parente88acd96184003169ba2c23cfd807243da100d72 (diff)
downloadgdb-7d74f2446c5ebad93f62426e285b64de882db843.zip
gdb-7d74f2446c5ebad93f62426e285b64de882db843.tar.gz
gdb-7d74f2446c5ebad93f62426e285b64de882db843.tar.bz2
* 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".
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r--gdb/cli/cli-cmds.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 983f017..7513ee4 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);