From: Jerome Guitton <guitton@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
Yao Qi <qiyaoltc@gmail.com>,
gdb-patches@sourceware.org
Subject: Re: [RFA] candidates for ambiguous command in upper case
Date: Wed, 11 Jan 2017 15:37:00 -0000 [thread overview]
Message-ID: <20170111153724.GG27546@adacore.com> (raw)
In-Reply-To: <2c7e674b-e827-f433-cbaf-a3d1a20cba80@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
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".
[-- Attachment #2: 2017-01-11-cli-decode.diff --]
[-- Type: text/x-diff, Size: 3429 bytes --]
commit 0eec4d84f57d5a214e00f3186f38d3af07584d86
Author: Jerome Guitton <guitton@adacore.com>
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<tab><tab>
shows "inferior info", but
(gdb) INF<tab><tab>
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 TERMINA\b\b\b\b\b\b\bterminal $" {
+ 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" {
next prev parent reply other threads:[~2017-01-11 15:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1484058324-5368-1-git-send-email-guitton@adacore.com>
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170111153724.GG27546@adacore.com \
--to=guitton@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=qiyaoltc@gmail.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox