From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 58BB6386F0E4 for ; Thu, 30 Jun 2022 16:01:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58BB6386F0E4 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-368-6iC9_is4Mc-2sdvZAC04VA-1; Thu, 30 Jun 2022 12:01:57 -0400 X-MC-Unique: 6iC9_is4Mc-2sdvZAC04VA-1 Received: by mail-wm1-f70.google.com with SMTP id v125-20020a1cac83000000b0039c832fbd02so1589860wme.4 for ; Thu, 30 Jun 2022 09:01:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=kV0gqj9qeII6Qkqvv3+iRmYxDAgM+CIp/i8cp6P/fnQ=; b=DtKEkJ/NTEWCSe/xT9s+LItFYx2n85A7AJbAaTqVtLfCJHSdSBmJGHFjam5EIYmppW Lg9QMAqnUEbG4Q7xDBlikB1cQBD6PzzQtwOpgAH9GyANRvvj7VXz0xe7o0ttLpM6EjC8 9WE9Pm69rnQs22MBQbGxZxwrCcpoOLRGFOwpoRPdIzh5exsjK1Itnr8/z+4T/cfY7Zlk wy9j/hY3JwgkQAeHQabm17J92D53MNhVC7L1wv2dC5DKpKztPJeAIiVlTIjCZVB27IAJ uCWGP+nUSwdeWrZlamnpg160OXcO1tBPxcqDjkqEA12LJNdXG26B5b1G+pD5sQYJCqfC IL3w== X-Gm-Message-State: AJIora8srxKQyH4hwv3M5Dl2bstqj2oB349ATqQYOYWC8xSQcuCzFnB+ NewFFHoZBBLzCK6hLzXCn4svEXURr35TDIgR7o5iUP/CP5IfEZKgxwr7nDb4mwlIVjXxquBztPC q3J1J4H7kDjLhydRsIXbm9g== X-Received: by 2002:a05:600c:b46:b0:3a0:4a51:bb1d with SMTP id k6-20020a05600c0b4600b003a04a51bb1dmr10758513wmr.168.1656604916208; Thu, 30 Jun 2022 09:01:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sj/U2Xbw9Tz2xD+OxgPP0fngdt/6U5dWV2fXV/KZs7SQja2A8z215Wob5XHspUTUiHucSgaw== X-Received: by 2002:a05:600c:b46:b0:3a0:4a51:bb1d with SMTP id k6-20020a05600c0b4600b003a04a51bb1dmr10758483wmr.168.1656604915923; Thu, 30 Jun 2022 09:01:55 -0700 (PDT) Received: from localhost (15.72.115.87.dyn.plus.net. [87.115.72.15]) by smtp.gmail.com with ESMTPSA id u20-20020a05600c19d400b0039c4f53c4fdsm3839635wmq.45.2022.06.30.09.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 09:01:55 -0700 (PDT) From: Andrew Burgess To: "Maciej W. Rozycki" Cc: Simon Sobisch , Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH v6 3/8] GDB: Add `NUMBER' completion to `set' integer commands In-Reply-To: References: <874k0aaylb.fsf@redhat.com> Date: Thu, 30 Jun 2022 17:01:54 +0100 Message-ID: <87wncyb0nh.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 16:02:01 -0000 "Maciej W. Rozycki" writes: > 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 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. Thanks for the update, this LGTM. Andrew > --- > 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 > + 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" > } >