This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] candidates for ambiguous command in upper case


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]