From adb483feb8b53555613d1165a6c6de4bdc1a5160 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 14 Jan 2009 20:40:09 +0000 Subject: * NEWS: Document "define" for prefixed commands. * cli/cli-cmds.c (show_user): Update calls to show_user_1. Call show_user_1 for prefix commands. * cli/cli-decode.c (help_cmd_list): Recurse for "help user-defined". * cli/cli-script.c (validate_comname): Rewrite to handle prefix commands. Return the containing command list. (define_command, document_command): Update to handle prefix commands. (show_user_1): Add prefix and name arguments. Handle prefix commands. * cli/cli-script.h (show_user_1): Update prototype. doc/ * gdb.texinfo (Define, Hooks): Document prefix command support. testsuite/ * gdb.base/define.exp: Test defining and hooking prefix commands. * gdb.python/python.exp: Update test for "show user" output. --- gdb/doc/gdb.texinfo | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gdb/doc/gdb.texinfo') diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 817b96b..583d96c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17573,6 +17573,10 @@ end @item define @var{commandname} Define a command named @var{commandname}. If there is already a command by that name, you are asked to confirm that you want to redefine it. +@var{commandname} may be a bare command name consisting of letters, +numbers, dashes, and underscores. It may also start with any predefined +prefix command. For example, @samp{define target my-target} creates +a user-defined @samp{target my-target} command. The definition of the command is made up of other @value{GDBN} command lines, which are given following the @code{define} command. The end of these @@ -17707,6 +17711,10 @@ not for command aliases; you should define a hook for the basic command name, e.g.@: @code{backtrace} rather than @code{bt}. @c FIXME! So how does Joe User discover whether a command is an alias @c or not? +You can hook a multi-word command by adding @code{hook-} or +@code{hookpost-} to the last word of the command, e.g.@: +@samp{define target hook-remote} to add a hook to @samp{target remote}. + If an error occurs during the execution of your hook, execution of @value{GDBN} commands stops and @value{GDBN} issues a prompt (before the command that you actually typed had a chance to run). -- cgit v1.1