aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-decode.c
diff options
context:
space:
mode:
authorJerome Guitton <guitton@adacore.com>2017-01-10 15:15:53 +0100
committerJerome Guitton <guitton@adacore.com>2017-02-08 19:03:25 +0100
commit604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4 (patch)
tree49f6059faa172e3ff89401319709a6f7ef2cff95 /gdb/cli/cli-decode.c
parent3d7b173c29900879c9a5958dd6029fd36666e57c (diff)
downloadgdb-604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4.zip
gdb-604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4.tar.gz
gdb-604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4.tar.bz2
Command abbreviation in define
When defining a new macro, "command" is not recognized as an alias for "commands": (gdb) define breakmain Type commands for definition of "breakmain". End with a line saying just "end". >break main >command >echo "IN MAIN\n" >end (gdb) There is a special case for while-stepping, where 'ws' and 'stepping' are recognized explicitely. Instead of adding more special cases, this change uses cli-decode. gdb/ChangeLog: * cli/cli-decode.c (find_command_name_length): Make it extern. * cli/cli-decode.h (find_command_name_length): Declare. * cli/cli-script.c (command_name_equals, line_first_arg): New functions. (process_next_line): Use cli-decode to parse command names. (build_command_line): Make args a constant pointer. gdb/testsuite/ChangeLog: * gdb.base/define.exp: Add test for command abbreviations in define.
Diffstat (limited to 'gdb/cli/cli-decode.c')
-rw-r--r--gdb/cli/cli-decode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 155d6d1..4e302b7 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1255,7 +1255,9 @@ find_cmd (const char *command, int len, struct cmd_list_element *clist,
return found;
}
-static int
+/* Return the length of command name in TEXT. */
+
+int
find_command_name_length (const char *text)
{
const char *p = text;