public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] candidates for ambiguous command in upper case
@ 2017-01-10 14:25 Jerome Guitton
  2017-01-10 15:07 ` Yao Qi
  0 siblings, 1 reply; 27+ messages in thread
From: Jerome Guitton @ 2017-01-10 14:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jerome Guitton

If you type an ambiguous command in lower case, gdb tells the command
is ambiguous and tells you which one could match. If you type the same
but in upper case, gdb also says it is ambiguous, but shows an empty
list of commands:

 (gdb) ex
 Ambiguous command "ex": exec-file, expression.
 (gdb) EX
 Ambiguous command "EX": .

Simple fix in attachment, with an additional test.
Tested on x86-linux. OK to apply?

gdb/ChangeLog:

	* cli-decode.c (lookup_cmd): case insensitive match when looking
	up candidates for ambigous command.

gdb/testsuite/ChangeLog:

	* gdb.base/completion.exp: Add test for ambiguous upper case
	command.
---
 gdb/cli/cli-decode.c                  |    2 +-
 gdb/testsuite/gdb.base/completion.exp |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index d3be93c..d59fe9b 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1550,7 +1550,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list, char *cmdtype,
 
 	  ambbuf[0] = 0;
 	  for (c = local_list; c; c = c->next)
-	    if (!strncmp (*line, c->name, amb_len))
+	    if (!strncasecmp (*line, c->name, amb_len))
 	      {
 		if (strlen (ambbuf) + strlen (c->name) + 6
 		    < (int) sizeof ambbuf)
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 4a3ee4b..9a7a221 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -265,6 +265,19 @@ gdb_test_multiple "" "$test" {
     }
 }
 
+set test "complete 'info T '"
+send_gdb "info T \t"
+gdb_test_multiple "" "$test" {
+    -re "^info T \\\x07$" {
+	send_gdb "\n"
+	gdb_test_multiple "" "$test" {
+	    -re "Ambiguous info command \"T \": target, tasks, terminal, threads, tp, tracepoints, tvariables, (type-printers, )?types\\..*$gdb_prompt $" {
+		pass "$test"
+	    }
+	}
+    }
+}
+
 set test "complete 'info t '"
 send_gdb "info t \t"
 gdb_test_multiple "" "$test" {
-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-08-28 21:20 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 14:25 [RFA] candidates for ambiguous command in upper case Jerome Guitton
2017-01-10 15:07 ` Yao Qi
2017-01-10 15:19   ` Jerome Guitton
2017-01-10 15:28     ` Simon Marchi
2017-01-10 15:40       ` Jerome Guitton
2017-01-10 17:00       ` Pedro Alves
2017-01-11 15:37         ` Jerome Guitton
2017-01-11 17:26         ` Yao Qi
2017-01-11 17:35           ` Luis Machado
2017-01-11 20:24           ` Pedro Alves
2017-01-12 10:18             ` Jerome Guitton
2017-01-12 16:37               ` Pedro Alves
2017-01-16 16:32                 ` Jerome Guitton
2017-01-17  1:58                   ` Pedro Alves
2017-01-17 16:29                     ` Luis Machado
2017-01-17 16:35                       ` Pedro Alves
2017-01-17 16:51                         ` Luis Machado
2017-01-17 17:04                           ` Pedro Alves
2017-01-17 17:13                             ` Luis Machado
2017-01-31 14:39                       ` Jerome Guitton
2017-01-31 15:20                         ` Pedro Alves
2017-02-08 18:05                           ` Jerome Guitton
2017-07-24 21:17                             ` Simon Marchi
2017-07-24 21:48                               ` [PATCH] define_command: Don't convert command name to lower case Simon Marchi
2017-07-24 21:54                                 ` Simon Marchi
2017-08-28 21:20                                   ` Simon Marchi
2017-07-26 12:42                                 ` Jerome Guitton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).