summaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-09-08 21:54:18 +0200
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-11-30 09:37:49 +0100
commitbe09caf15d3d57da2173d26abdb0bf92ef90f28f (patch)
treedee1e80c88e618bec9c24fe31e9a0f226d9208ec /gdb/completer.c
parent643c0cbedb4647702778ca8788a54053d1259d3b (diff)
downloadbinutils-gdb-be09caf15d3d57da2173d26abdb0bf92ef90f28f.tar.gz
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.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index b34b7762c62..6658da6d7fb 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -102,13 +102,13 @@ enum explicit_location_match_type
/* Variables which are necessary for fancy command line editing. */
-/* When completing on command names, we remove '-' from the list of
+/* When completing on command names, we remove '-' and '.' from the list of
word break characters, since we use it in command names. If the
readline library sees one in any of the current completion strings,
it thinks that the string needs to be quoted and automatically
supplies a leading quote. */
static const char gdb_completer_command_word_break_characters[] =
-" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
+" \t\n!@#$%^&*()+=|~`}{[]\"';:?/><,";
/* When completing on file names, we remove from the list of word
break characters any characters that are commonly used in file
@@ -1284,7 +1284,7 @@ complete_line_internal_1 (completion_tracker &tracker,
on command strings (as opposed to strings supplied by the
individual command completer functions, which can be any string)
then we will switch to the special word break set for command
- strings, which leaves out the '-' character used in some
+ strings, which leaves out the '-' and '.' character used in some
commands. */
set_rl_completer_word_break_characters
(current_language->la_word_break_characters());
@@ -1347,7 +1347,7 @@ complete_line_internal_1 (completion_tracker &tracker,
/* lookup_cmd_1 advances p up to the first ambiguous thing, but
doesn't advance over that thing itself. Do so now. */
q = p;
- while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
+ while (valid_cmd_char_p (*q))
++q;
if (q != tmp_command + point)
{
@@ -1435,7 +1435,7 @@ complete_line_internal_1 (completion_tracker &tracker,
q = p;
while (q > tmp_command)
{
- if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
+ if (valid_cmd_char_p (q[-1]))
--q;
else
break;