From: "Maciej W. Rozycki" <macro@embecosm.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org, Simon Sobisch <simonsobisch@web.de>,
Tom Tromey <tom@tromey.com>
Subject: [PATCH v6 3/8] GDB: Add `NUMBER' completion to `set' integer commands
Date: Thu, 30 Jun 2022 15:24:01 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.2.20.2206301420590.10833@tpp.orcam.me.uk> (raw)
In-Reply-To: <874k0aaylb.fsf@redhat.com>
Fix a completion consistency issue with `set' commands accepting integer
values and the special `unlimited' keyword:
(gdb) complete print -elements
print -elements NUMBER
print -elements unlimited
(gdb)
vs:
(gdb) complete set print elements
set print elements unlimited
(gdb)
(there is a space entered at the end of both commands, not shown here)
which also means if you strike <Tab> with `set print elements ' input,
it will, annoyingly, complete to `set print elements unlimited' right
away rather than showing a choice between `NUMBER' and `unlimited'.
Add `NUMBER' then as an available completion for such `set' commands:
(gdb) complete set print elements
set print elements NUMBER
set print elements unlimited
(gdb)
Adjust the testsuite accordingly. Also document the feature in the
Completion section of the manual in addition to the Command Options
section already there.
---
On Fri, 24 Jun 2022, Andrew Burgess wrote:
> > Add `NUMBER' then as an available completion for such `set' commands:
> >
> > (gdb) complete set print elements
> > set print elements NUMBER
> > set print elements unlimited
> > (gdb)
> >
> > Adjust the testsuite accordingly.
>
> I like this change, but I think we should add some documentation in
> `@node Completion` that describes this new behaviour. We should probably
> add a NEWS entry too.
Thank you for your review.
This is already documented in the Command Options section, but that's not
necessarily the place one will look for it, so maybe it's worth repeating
here as well indeed. I have changed the wording slightly compared to the
original.
How about this version then?
Maciej
Changes from v5:
- document the `NUMBER' completion in the Completion section of the manual
for commands accepting keywords as well as numbers,
- document the addition of `NUMBER' completion for `set' commands in NEWS.
No change from v4.
New change in v4.
---
gdb/NEWS | 12 ++++++++++++
gdb/cli/cli-decode.c | 2 ++
gdb/doc/gdb.texinfo | 15 +++++++++++++++
gdb/testsuite/gdb.base/settings.exp | 8 +++++++-
4 files changed, 36 insertions(+), 1 deletion(-)
gdb-integer-complete-number.diff
Index: src/gdb/NEWS
===================================================================
--- src.orig/gdb/NEWS
+++ src/gdb/NEWS
@@ -27,6 +27,18 @@
emit to indicate where a breakpoint should be placed to break in a function
past its prologue.
+* Completion now also offers "NUMBER" for "set" commands that accept
+ a numeric argument and the "unlimited" keyword. For example:
+
+ (gdb) set width <TAB>
+ NUMBER unlimited
+
+ and consequently:
+
+ (gdb) complete set width
+ set width NUMBER
+ set width unlimited
+
* New commands
maintenance set ignore-prologue-end-flag on|off
Index: src/gdb/cli/cli-decode.c
===================================================================
--- src.orig/gdb/cli/cli-decode.c
+++ src/gdb/cli/cli-decode.c
@@ -989,6 +989,8 @@ integer_unlimited_completer (struct cmd_
NULL,
};
+ if (*text == '\0')
+ tracker.add_completion (make_unique_xstrdup ("NUMBER"));
complete_on_enum (tracker, keywords, text, word);
}
Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo
+++ src/gdb/doc/gdb.texinfo
@@ -1960,6 +1960,21 @@ After displaying the available possibili
partial input (@samp{b make_} in the example) so you can finish the
command.
+If the command you are trying to complete expects either a keyword or a
+number to follow, then @samp{NUMBER} will be shown among the available
+completions, for example:
+
+@smallexample
+(@value{GDBP}) print -elements @key{TAB}@key{TAB}
+NUMBER unlimited
+(@value{GDBP}) print -elements@tie{}
+@end smallexample
+
+@noindent
+Here, the option expects a number (e.g., @code{100}), not literal
+@code{NUMBER}. Such metasyntactical arguments are always presented in
+uppercase.
+
If you just want to see the list of alternatives in the first place, you
can press @kbd{M-?} rather than pressing @key{TAB} twice. @kbd{M-?}
means @kbd{@key{META} ?}. You can type this either by holding down a
Index: src/gdb/testsuite/gdb.base/settings.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/settings.exp
+++ src/gdb/testsuite/gdb.base/settings.exp
@@ -215,8 +215,14 @@ proc test-integer {variant} {
test_gdb_complete_none \
"$set_cmd "
} else {
+ test_gdb_complete_multiple "$set_cmd " "" "" {
+ "NUMBER"
+ "unlimited"
+ }
+ test_gdb_complete_none \
+ "$set_cmd 1"
test_gdb_complete_unique \
- "$set_cmd " \
+ "$set_cmd u" \
"$set_cmd unlimited"
}
next prev parent reply other threads:[~2022-06-30 14:24 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 10:23 [PATCH v5 0/8] gdb: split array and string limiting options Maciej W. Rozycki
2022-03-30 10:23 ` [PATCH v5 1/8] GDB: Remove extraneous full stops from `set' command error messages Maciej W. Rozycki
2022-06-24 14:32 ` Andrew Burgess
2022-06-29 14:29 ` Maciej W. Rozycki
2022-03-30 10:23 ` [PATCH v5 2/8] GDB/Python: Use None for `var_zuinteger_unlimited' value set to `unlimited' Maciej W. Rozycki
2022-03-30 10:35 ` Simon Sobisch
2022-03-30 10:40 ` Maciej W. Rozycki
2022-03-30 10:50 ` Simon Sobisch
2022-03-30 11:52 ` Maciej W. Rozycki
2022-06-24 14:40 ` Andrew Burgess
2022-06-29 16:48 ` Maciej W. Rozycki
2022-03-30 10:24 ` [PATCH v5 3/8] GDB: Add `NUMBER' completion to `set' integer commands Maciej W. Rozycki
2022-05-25 18:36 ` Bruno Larsen
2022-05-26 10:09 ` Maciej W. Rozycki
2022-05-26 11:46 ` Bruno Larsen
2022-05-26 14:24 ` Maciej W. Rozycki
2022-06-24 15:08 ` Andrew Burgess
2022-06-30 14:24 ` Maciej W. Rozycki [this message]
2022-06-30 15:53 ` [PATCH v6 " Eli Zaretskii
2022-06-30 18:59 ` Maciej W. Rozycki
2022-06-30 16:01 ` Andrew Burgess
2022-03-30 10:24 ` [PATCH v5 4/8] GDB/testsuite: Tighten `set print elements' error check Maciej W. Rozycki
2022-06-24 15:09 ` Andrew Burgess
2022-06-29 14:29 ` Maciej W. Rozycki
2022-03-30 10:24 ` [PATCH v5 5/8] GDB/testsuite: Add coverage for `print -elements' command Maciej W. Rozycki
2022-06-24 15:57 ` Andrew Burgess
2022-07-07 11:04 ` Maciej W. Rozycki
2022-03-30 10:24 ` [PATCH v5 6/8] GDB: Allow arbitrary keywords in integer set commands Maciej W. Rozycki
2022-03-30 10:42 ` Simon Sobisch
2022-03-30 10:58 ` Maciej W. Rozycki
2022-06-28 14:04 ` Andrew Burgess
2022-08-17 22:03 ` Maciej W. Rozycki
2022-03-30 10:24 ` [PATCH v5 7/8] GDB: Add a character string limiting option Maciej W. Rozycki
2022-03-30 12:29 ` Eli Zaretskii
2022-03-30 10:24 ` [PATCH v5 8/8] GDB/testsuite: Expand for character string limiting options Maciej W. Rozycki
2022-04-13 11:20 ` [PING][PATCH v5 0/8] gdb: split array and " Maciej W. Rozycki
2022-04-13 12:10 ` Simon Sobisch
2022-04-13 12:18 ` Maciej W. Rozycki
2022-04-20 19:17 ` [PING^2][PATCH " Maciej W. Rozycki
2022-04-26 19:57 ` Simon Sobisch
2022-04-27 12:00 ` Maciej W. Rozycki
2022-04-27 12:02 ` [PING^3][PATCH " Maciej W. Rozycki
2022-05-04 10:05 ` [PING^4][PATCH " Maciej W. Rozycki
2022-05-12 21:20 ` [PING^5][PATCH " Maciej W. Rozycki
2022-05-20 10:49 ` [PING^6][PATCH " Maciej W. Rozycki
2022-05-25 15:52 ` [PING^7][PATCH " Maciej W. Rozycki
2022-05-25 19:20 ` [PATCH " Bruno Larsen
2022-06-02 17:55 ` [PING^8][PATCH " Maciej W. Rozycki
2022-06-07 17:23 ` Simon Sobisch
2022-06-15 22:47 ` [PING^9][PATCH " Maciej W. Rozycki
2022-06-22 11:25 ` [PING^10][PATCH " Maciej W. Rozycki
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=alpine.DEB.2.20.2206301420590.10833@tpp.orcam.me.uk \
--to=macro@embecosm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simonsobisch@web.de \
--cc=tom@tromey.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).