From patchwork Tue Jun 4 22:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32992 Received: (qmail 45932 invoked by alias); 4 Jun 2019 22:35:12 -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 45859 invoked by uid 89); 4 Jun 2019 22:35:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=exercises, sorts X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Jun 2019 22:35:10 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18881C1EB203 for ; Tue, 4 Jun 2019 22:35:09 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0ACB19C69 for ; Tue, 4 Jun 2019 22:35:08 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 07/24] Remove "show" command completers, "set" command completers for string commands Date: Tue, 4 Jun 2019 23:34:27 +0100 Message-Id: <20190604223444.26472-8-palves@redhat.com> In-Reply-To: <20190604223444.26472-1-palves@redhat.com> References: <20190604223444.26472-1-palves@redhat.com> The default command completer is symbol_completer, but it makes no sense for a "show" command to complete on symbols, or anything else, really. I wonder whether we should instead make the default be no completer. That seems like a much larger/complicated audit/change, so I'd like to move forward with this version, as it'll be covered by tests. I noticed this because a following patch will add a new gdb.base/settings.exp testcase that exercises all sorts of details of settings commands, including completing the show commands, using new representative "maint test-settings " commands. Also remove the completer for var_string and var_string_noescape commands. No point in completing symbols when GDB is expecting a string. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * cli/cli-decode.c (add_setshow_cmd_full): Remove "show" completer. (add_setshow_string_cmd, add_setshow_string_noescape_cmd): Remove "set" completers. --- gdb/cli/cli-decode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index e59e0c70409..30f79b5259d 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -509,6 +509,9 @@ add_setshow_cmd_full (const char *name, full_show_doc, show_list); show->doc_allocated = 1; show->show_value_func = show_func; + /* Disable the default symbol completer. Doesn't make much sense + for the "show" command to complete on anything. */ + set_cmd_completer (show, nullptr); if (set_result != NULL) *set_result = set; @@ -633,11 +636,16 @@ add_setshow_string_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { + cmd_list_element *set_cmd; + add_setshow_cmd_full (name, theclass, var_string, var, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list, - NULL, NULL); + &set_cmd, NULL); + + /* Disable the default symbol completer. */ + set_cmd_completer (set_cmd, nullptr); } /* Add element named NAME to both the set and show command LISTs (the @@ -659,6 +667,10 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass, set_func, show_func, set_list, show_list, &set_cmd, NULL); + + /* Disable the default symbol completer. */ + set_cmd_completer (set_cmd, nullptr); + return set_cmd; }