From patchwork Wed Jan 11 15:37: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: 90922 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1179795qgi; Wed, 11 Jan 2017 07:37:46 -0800 (PST) X-Received: by 10.98.71.3 with SMTP id u3mr10923458pfa.66.1484149066644; Wed, 11 Jan 2017 07:37:46 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u20si6121261plj.268.2017.01.11.07.37.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 07:37:46 -0800 (PST) Received-SPF: pass (google.com: domain of gdb-patches-return-136130-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of gdb-patches-return-136130-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gdb-patches-return-136130-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=Y1H6 gIxB/2m60ln1MquN9vLjXyAE4KOmIhtsHYLPS6FCWpvIofYxmaIg92nUvnl9oTBS PUNa9Sa1HUNdh9K149UVMlp9ToJknYIQumFJl1KA7JpAS+89IaosFkLlUyt3Ywbd q76QjvfYY69LUFFPVHkq0uOlpgPvlR0mIvupnnA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=tbeZYoYfK+ jcTP8LXbP8pnVvXQE=; b=jCG3aioTfg39DPPQzoaQPU/gkQ3AQHuDtdQfQEUr7N t2RGJVT3wcGa7S5xj88YlQfrD3iPGupXb6QV9c/tCCY63UGh+hvb9fc6zFkCgAEC iVRqg+Ebtcd0j/wh2gHo31gGafrgObo593NJbq937ZHejFarU/eydNvNI2hwN9PN g= Received: (qmail 120761 invoked by alias); 11 Jan 2017 15:37:38 -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 119651 invoked by uid 89); 11 Jan 2017 15:37:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=U*palves, sk:palves@, palvesredhatcom, sk:palves 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; Wed, 11 Jan 2017 15:37:27 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3D29C8383F; Wed, 11 Jan 2017 16:37:25 +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 1KNJo02TCZR6; Wed, 11 Jan 2017 16:37:25 +0100 (CET) Received: from chelles.act-europe.fr (chelles.act-europe.fr [10.10.0.160]) by smtp.eu.adacore.com (Postfix) with ESMTP id 083038383E; Wed, 11 Jan 2017 16:37:25 +0100 (CET) Received: by chelles.act-europe.fr (Postfix, from userid 560) id 043F91EA0067; Wed, 11 Jan 2017 16:37:25 +0100 (CET) Date: Wed, 11 Jan 2017 16:37:24 +0100 From: Jerome Guitton To: Pedro Alves Cc: Simon Marchi , Yao Qi , gdb-patches@sourceware.org Subject: Re: [RFA] candidates for ambiguous command in upper case Message-ID: <20170111153724.GG27546@adacore.com> References: <1484058324-5368-1-git-send-email-guitton@adacore.com> <20170110150731.GH9518@E107787-LIN> <20170110151944.GD27546@adacore.com> <2c7e674b-e827-f433-cbaf-a3d1a20cba80@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2c7e674b-e827-f433-cbaf-a3d1a20cba80@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Pedro Alves (palves@redhat.com): > In my branch I've completely changed how GDB hands over > completion matches to readline, and I've had to make > sure to preserve that behavior, as caught by some test. Interesting! When do you think that this branch would be merged in master? Still interested in my patch in the meantime? I guess that the new tests would be useful in any case. Last version in attachment. There was already a test for "info sysq", I've added "info T" and "info TERMINA". commit 0eec4d84f57d5a214e00f3186f38d3af07584d86 Author: Jerome Guitton Date: Tue Jan 10 15:10:08 2017 +0100 [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": . The same issue with completion. (gdb) inf shows "inferior info", but (gdb) INF shows nothing. 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 ambiguous command. (complete_on_cmdlist): Ditto. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Add tests for completion of upper case commands. diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index d3be93c..dbd874e 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) @@ -1800,7 +1800,7 @@ complete_on_cmdlist (struct cmd_list_element *list, for (pass = 0; matchlist == 0 && pass < 2; ++pass) { for (ptr = list; ptr; ptr = ptr->next) - if (!strncmp (ptr->name, text, textlen) + if (!strncasecmp (ptr->name, text, textlen) && !ptr->abbrev_flag && (!ignore_help_classes || ptr->func || ptr->prefixlist)) diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 4a3ee4b..cae45ae 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -30,6 +30,8 @@ # "info t foo" no completions # "info t " no completions # "info t" ambiguous ("info target", "info terminal", etc.) +# "info T" ambiguous ("info target", "info terminal", etc.) +# "info TERMINA" unambiguous (completes to "info terminal") # "info ajksdlfk" no completions # "info ajksdlfk " no completions # "info" " " @@ -265,6 +267,32 @@ 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 TERMINA'" +send_gdb "info TERMINA\t" +gdb_test_multiple "" "$test" { + -re "^info TERMINAterminal $" { + send_gdb "\n" + gdb_test_multiple "" "$test" { + -re "Inferior's terminal status.*$gdb_prompt $" { + pass "$test" + } + } + } +} + set test "complete 'info t '" send_gdb "info t \t" gdb_test_multiple "" "$test" {