From patchwork Tue Jan 10 14:25:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Guitton X-Patchwork-Id: 18841 Received: (qmail 78556 invoked by alias); 10 Jan 2017 14:25:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 78542 invoked by uid 89); 10 Jan 2017 14:25:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=265, 6 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jan 2017 14:25:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id E5F4082FC1; Tue, 10 Jan 2017 15:25:37 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id STkcvHxQk5Kh; Tue, 10 Jan 2017 15:25:37 +0100 (CET) Received: from chelles.act-europe.fr (chelles.act-europe.fr [IPv6:2a02:2ab8:224:1:d6be:d9ff:fef8:4565]) by smtp.eu.adacore.com (Postfix) with ESMTP id D405382FBF; Tue, 10 Jan 2017 15:25:37 +0100 (CET) Received: by chelles.act-europe.fr (Postfix, from userid 560) id CDC801EA0067; Tue, 10 Jan 2017 15:25:37 +0100 (CET) From: Jerome Guitton To: gdb-patches@sourceware.org Cc: Jerome Guitton Subject: [RFA] candidates for ambiguous command in upper case Date: Tue, 10 Jan 2017 15:25:24 +0100 Message-Id: <1484058324-5368-1-git-send-email-guitton@adacore.com> 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" {