From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@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 15:37:00 -0000 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-Type: multipart/mixed; boundary="J2SCkAp4GZ/dPZZf" Content-Disposition: inline In-Reply-To: <2c7e674b-e827-f433-cbaf-a3d1a20cba80@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2017-01/txt/msg00186.txt.bz2 --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 496 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". --J2SCkAp4GZ/dPZZf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="2017-01-11-cli-decode.diff" Content-Transfer-Encoding: quoted-printable Content-length: 3457 commit 0eec4d84f57d5a214e00f3186f38d3af07584d86 Author: Jerome Guitton Date: Tue Jan 10 15:10:08 2017 +0100 [RFA] candidates for ambiguous command in upper case =20=20=20=20 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: =20=20=20=20 (gdb) ex Ambiguous command "ex": exec-file, expression. (gdb) EX Ambiguous command "EX": . =20=20=20=20 The same issue with completion. =20=20=20=20 (gdb) inf =20=20=20=20 shows "inferior info", but =20=20=20=20 (gdb) INF =20=20=20=20 shows nothing. =20=20=20=20 Simple fix in attachment, with an additional test. Tested on x86-linux. OK to apply? =20=20=20=20 gdb/ChangeLog: =20=20=20=20 * cli-decode.c (lookup_cmd): case insensitive match when looking up candidates for ambiguous command. (complete_on_cmdlist): Ditto. =20=20=20=20 gdb/testsuite/ChangeLog: =20=20=20=20 * 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_elemen= t *list, char *cmdtype, =20 ambbuf[0] =3D 0; for (c =3D local_list; c; c =3D 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 =3D 0; matchlist =3D=3D 0 && pass < 2; ++pass) { for (ptr =3D list; ptr; ptr =3D 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" { } } =20 +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 TERMINA=08=08=08=08=08=08=08terminal $" { + 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" { --J2SCkAp4GZ/dPZZf--