Command abbreviation in define
authorJerome Guitton <guitton@adacore.com>
Tue, 10 Jan 2017 14:15:53 +0000 (15:15 +0100)
committerJerome Guitton <guitton@adacore.com>
Wed, 8 Feb 2017 18:03:25 +0000 (19:03 +0100)
commit604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4
tree49f6059faa172e3ff89401319709a6f7ef2cff95
parent3d7b173c29900879c9a5958dd6029fd36666e57c
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.
gdb/ChangeLog
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/cli/cli-script.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/define.exp