Allow . character as part of command names.

This patch adds . as an allowed character for user defined commands.
Combined with 'define-prefix', this allows to e.g. define a set of Valgrind
specific user command corresponding to the Valgrind monitor commands
(such as check_memory, v.info, v.set, ...).

gdb/ChangeLog
2019-11-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* command.h (valid_cmd_char_p): Declare.
	* cli/cli-decode.c (valid_cmd_char_p): New function factorizing
	the check of valid command char.
	(find_command_name_length, valid_user_defined_cmd_name_p): Use
	valid_cmd_char_p.
	* cli/cli-script.c (validate_comname): Likewise.
	* completer.c (gdb_completer_command_word_break_characters):
	Do not remove . from the word break char, update comments.
	(complete_line_internal_1): Use valid_cmd_char_p.
	* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
	* python/py-cmd.c (gdbpy_parse_command_name): Likewise.

gdb/testsuite/ChangeLog
2019-11-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/define.exp: Test . in command names.
	* gdb.base/setshow.exp: Update test, as . is now part of
	command name.
This commit is contained in:
Philippe Waroquiers
2019-09-08 21:54:18 +02:00
parent 643c0cbedb
commit be09caf15d
10 changed files with 76 additions and 25 deletions

View File

@ -133,8 +133,16 @@ extern struct cli_suppress_notification cli_suppress_notification;
/* API to the manipulation of command lists. */
/* Return TRUE if NAME is a valid user-defined command name.
This is a stricter subset of all gdb commands,
see find_command_name_length. */
extern bool valid_user_defined_cmd_name_p (const char *name);
/* Return TRUE if C is a valid command character. */
extern bool valid_cmd_char_p (int c);
/* Const-correct variant of the above. */
extern struct cmd_list_element *add_cmd (const char *, enum command_class,