From be09caf15d3d57da2173d26abdb0bf92ef90f28f Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Sun, 8 Sep 2019 21:54:18 +0200 Subject: 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 * 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 * gdb.base/define.exp: Test . in command names. * gdb.base/setshow.exp: Update test, as . is now part of command name. --- gdb/python/py-cmd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gdb/python/py-cmd.c') diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 3897340..8d6f01b 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -372,10 +372,7 @@ gdbpy_parse_command_name (const char *name, lastchar = i; /* Find first character of the final word. */ - for (; i > 0 && (isalnum (name[i - 1]) - || name[i - 1] == '-' - || name[i - 1] == '_'); - --i) + for (; i > 0 && valid_cmd_char_p (name[i - 1]); --i) ; result = (char *) xmalloc (lastchar - i + 2); memcpy (result, &name[i], lastchar - i + 1); -- cgit v1.1