From patchwork Sun Jan 12 12:03:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 104606 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FD603858406 for ; Sun, 12 Jan 2025 12:06:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FD603858406 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=UAkWIAOq X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id EDBB43857810 for ; Sun, 12 Jan 2025 12:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EDBB43857810 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EDBB43857810 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683449; cv=none; b=YeOUbczoUiOLrd2RsOQjTcRhBT3WX7OuRNvBRO1A+ttqP6vclf724ctKGFSIlurIcs3UrfbfcZIY9IT+9E4effU5gX/iVr0D+M8uXI1gqx7rFvOO/uiwMmDfEXgi6+I+fRbJ7N5PqIBufbxVZw+VEtLjtKvvYoR1Mm2tlI42VkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683449; c=relaxed/simple; bh=3/gbdN+ZUMJQ5j7594Bq7XoqNISMXk87s9sXvpdiY48=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=NB13qbQ2SvavvrOuxhneznTtaOtZn5SvRDJ0Yca+7CUkBDmXK+XoC0Qm+7F45h8J9DabwRfs0pSN3wLdAvEm/wtpxXdTE97/jIINNUXZ59pQXlEsj5n220PxoLlvLS/KvkQSVBLddWRM+QLjeqsZD8HH2hwpmJmu6EaQP5UbDhg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDBB43857810 Received: from eig-obgw-5004a.ext.cloudfilter.net ([10.0.29.221]) by cmsmtp with ESMTPS id WagitikieqewVWwhMtXCet; Sun, 12 Jan 2025 12:04:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id WwhKtmxwmWvXpWwhLtOLve; Sun, 12 Jan 2025 12:04:07 +0000 X-Authority-Analysis: v=2.4 cv=LtdZyWdc c=1 sm=1 tr=0 ts=6783afb7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=VdSt8ZQiCzkA:10 a=ItBw4LHWJt0A:10 a=JOfjbqwot2fvHNstPakA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FMiM/GYWHImEFxIePjtbZvXAFe3/NX0idrntabxwYWU=; b=UAkWIAOqkAEmfNnRqmATYlB9x8 CZqKL/WTJXjaCuUXmxb4hzs6flX3iTHoiCqsD6HT/Eoa9AQy1fthFnsUY+mcxcMhAraSI1QZZbDBW RFo4z1p7SMPgRdSKuCDMiq9jr; Received: from 97-118-36-154.hlrn.qwest.net ([97.118.36.154]:46946 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1tWwhK-00212c-1n; Sun, 12 Jan 2025 05:04:06 -0700 From: Tom Tromey Date: Sun, 12 Jan 2025 05:03:58 -0700 Subject: [PATCH 1/4] Avoid calling help_list in more places MIME-Version: 1.0 Message-Id: <20250112-submit-help-list-style-title-v1-1-9457a2686440@tromey.com> References: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> In-Reply-To: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.36.154 X-Source-L: No X-Exim-ID: 1tWwhK-00212c-1n X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-36-154.hlrn.qwest.net (prentzel.local) [97.118.36.154]:46946 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNFh4Y/CMrxwMWpN0UK/EvHS075UNpKOEPm7HrYCJ9l89yi9AcGQNmZC/d3JGsCXeUo8Tev9fJMcUxs5vCq4g1m+LmMxnnjS9dls3ZWtVl53AbMjx6qT i9LuubYz/e6VkbKMknZVwMauSxeoDBabxuqQtmfXklzY0fVZGf0zSLduoPCz8LvQ/Up9Ltp4odOZ4xYoOxaeQktyffxx4ZMCafQ= X-Spam-Status: No, score=-3020.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org I think there is no need to have a prefix command that simply calls help_list. Instead, add_basic_prefix_cmd can be used. This patch changes the relevant instances. In one spot, add_setshow_prefix_cmd is used instead. --- gdb/printcmd.c | 10 +--------- gdb/source.c | 29 ++++++----------------------- gdb/tui/tui-layout.c | 10 +--------- gdb/tui/tui-win.c | 14 +++----------- 4 files changed, 11 insertions(+), 52 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f1aaa644042e93a3435d7aaa4e8d26bfe9185f10..a9c4e935f3a6e088cc01af1d74097fa08afffbda 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2922,14 +2922,6 @@ show_memory_tagging_unsupported (void) " architecture.")); } -/* Implement the "memory-tag" prefix command. */ - -static void -memory_tag_command (const char *arg, int from_tty) -{ - help_list (memory_tag_list, "memory-tag ", all_commands, gdb_stdout); -} - /* Helper for print-logical-tag and print-allocation-tag. */ static void @@ -3386,7 +3378,7 @@ Convert the arguments to a string as \"printf\" would, but then\n\ treat this string as a command line, and evaluate it.")); /* Memory tagging commands. */ - add_prefix_cmd ("memory-tag", class_vars, memory_tag_command, _("\ + add_basic_prefix_cmd ("memory-tag", class_vars, _("\ Generic command for printing and manipulating memory tag properties."), &memory_tag_list, 0, &cmdlist); add_cmd ("print-logical-tag", class_vars, diff --git a/gdb/source.c b/gdb/source.c index a225280e794631908aeceab6110421bb7bd29089..0d6523cd305385b51af67bc6fa41d4c1e1075342 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1909,22 +1909,6 @@ source_lines_range::source_lines_range (int startline, } } -/* Handle the "set source" base command. */ - -static void -set_source (const char *arg, int from_tty) -{ - help_list (setsourcelist, "set source ", all_commands, gdb_stdout); -} - -/* Handle the "show source" base command. */ - -static void -show_source (const char *args, int from_tty) -{ - help_list (showsourcelist, "show source ", all_commands, gdb_stdout); -} - void _initialize_source (); void @@ -2045,13 +2029,12 @@ By default, relative filenames are displayed."), show_filename_display_string, &setlist, &showlist); - add_prefix_cmd ("source", no_class, set_source, - _("Generic command for setting how sources are handled."), - &setsourcelist, 0, &setlist); - - add_prefix_cmd ("source", no_class, show_source, - _("Generic command for showing source settings."), - &showsourcelist, 0, &showlist); + add_setshow_prefix_cmd + ("source", no_class, + _("Generic command for setting how sources are handled."), + _("Generic command for showing source settings."), + &setsourcelist, &showsourcelist, + &setlist, &showlist); add_setshow_boolean_cmd ("open", class_files, &source_open, _("\ Set whether GDB should open source files."), _("\ diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 2b6cb3194ae024479540d5a032e6dd97ff9e6081..79b7289c2a61fe93c5c1aa8cc375ff3bc9129fc1 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -1120,14 +1120,6 @@ destroy_layout (struct cmd_list_element *self, void *context) static struct cmd_list_element *layout_list; -/* Called to implement 'tui layout'. */ - -static void -tui_layout_command (const char *args, int from_tty) -{ - help_list (layout_list, "tui layout ", all_commands, gdb_stdout); -} - /* Add a "layout" command with name NAME that switches to LAYOUT. */ static struct cmd_list_element * @@ -1307,7 +1299,7 @@ void _initialize_tui_layout () { struct cmd_list_element *layout_cmd - = add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\ + = add_basic_prefix_cmd ("layout", class_tui, _("\ Change the layout of windows.\n\ Usage: tui layout prev | next | LAYOUT-NAME"), &layout_list, 0, tui_get_cmd_list ()); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 414d4699bea7e1cffd8a22439d739e4101abc40c..33b24d8946d9e770f2466648c05f4f89e8407ea9 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1082,14 +1082,6 @@ parse_scrolling_args (const char *arg, static cmd_list_element *tui_window_cmds = nullptr; -/* Called to implement 'tui window'. */ - -static void -tui_window_command (const char *args, int from_tty) -{ - help_list (tui_window_cmds, "tui window ", all_commands, gdb_stdout); -} - /* See tui-win.h. */ bool tui_left_margin_verbose = false; @@ -1125,9 +1117,9 @@ Usage: tabset N")); deprecate_cmd (tabset_cmd, "set tui tab-width"); /* Setup the 'tui window' list of command. */ - add_prefix_cmd ("window", class_tui, tui_window_command, - _("Text User Interface window commands."), - &tui_window_cmds, 1, tui_get_cmd_list ()); + add_basic_prefix_cmd ("window", class_tui, + _("Text User Interface window commands."), + &tui_window_cmds, 1, tui_get_cmd_list ()); cmd_list_element *winheight_cmd = add_cmd ("height", class_tui, tui_set_win_height_command, _("\ From patchwork Sun Jan 12 12:03:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 104607 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E82D3857707 for ; Sun, 12 Jan 2025 12:06:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E82D3857707 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=YZuIpej2 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 830D2385840A for ; Sun, 12 Jan 2025 12:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 830D2385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 830D2385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; cv=none; b=a0ThDceqrkH+oZePYi35Vba9JWml7vdvP5Ses16rhMhG2EPo8wbtEGQeiyxrHYdpwA+JUOyYnWTdo1rVLY4lcc6Rb+CPSdJ1216gGjL07m10GFtxgzRMXtKbJeB9Lg+xa/eQb+26A9TUWPQXbZuQEFhg5/iRHouIIe1Hsw3ugwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; c=relaxed/simple; bh=vueTVv2yD+HldVtP6ZZno6S6/pDKDf9dDKV+uVhEAXc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=hoEWUGjxiDAOBTcPstH4/H9wDCZkcWp8jqQkYR3pDS+Ar7NKpR96aniZvI42iFLIj/xIRhYNmk3xv9QM97lUsTcqGyxnRwrEXpX2aq5MadMMu4c4nKfLbUeu7a+lVyyBtv0JGZcoSN50eq+hcmghMQdKunvnc8h6XVHzhu48uTw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 830D2385840A Received: from eig-obgw-5008a.ext.cloudfilter.net ([10.0.29.246]) by cmsmtp with ESMTPS id WmErtAezkrKrbWwhMt7aqU; Sun, 12 Jan 2025 12:04:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id WwhLtP1txLy0yWwhLtMnCD; Sun, 12 Jan 2025 12:04:07 +0000 X-Authority-Analysis: v=2.4 cv=OtZJyT/t c=1 sm=1 tr=0 ts=6783afb7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=VdSt8ZQiCzkA:10 a=ItBw4LHWJt0A:10 a=n6tqjzniSf3So5Y6R5EA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vWb/3ORb+8UTJVgKxW4MSxbrVqQqlh5+XfVfPINiOZs=; b=YZuIpej2al4Nq+pGrsLWVzIbx6 kV/m16ce0SlKU5veXNgV92/hEfAXfRNA1apRjHG83TsQqrvGW0keFxDVUzICSFOS4g5tvycp9D7pC zjKlvJbFJDZvgIxabKzQlOyr2; Received: from 97-118-36-154.hlrn.qwest.net ([97.118.36.154]:46946 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1tWwhK-00212c-2l; Sun, 12 Jan 2025 05:04:06 -0700 From: Tom Tromey Date: Sun, 12 Jan 2025 05:03:59 -0700 Subject: [PATCH 2/4] Use command style in "help" command MIME-Version: 1.0 Message-Id: <20250112-submit-help-list-style-title-v1-2-9457a2686440@tromey.com> References: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> In-Reply-To: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.36.154 X-Source-L: No X-Exim-ID: 1tWwhK-00212c-2l X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-36-154.hlrn.qwest.net (prentzel.local) [97.118.36.154]:46946 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEOsOH8ArXQi4RyuBjuVf/L9wIhsanvKsdFSqSw6riZwSXkviOEoRTocH7H3pR2pVm+zmoZ9K+WkB9f9LiYH8Gp7QOwAH5Ld7RSI+C2E5L9qvo3VnUoV g1NUsNf/MPqQnYZAx58e5SI6Dc5nriA9stWQOSw7FbD1z3A2hzDuIVEhJuYdYm2fk0KGq5H1vnEb+itT7s8tWaunVvnfMaTE044= X-Spam-Status: No, score=-3020.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org This changes the help command to use the new command style when displaying text like: List of "catch" subcommands: As a side effect, this mildly -- but not hugely -- cleans up some i18n issues in help_list. The header comment for that function is also changed to the gdb style. Finally, this function used to print something like: Type "help catch" followed by catch subcommand name for full documentation. The second "catch" here seems redundant to me, so this patch removes it. --- gdb/cli/cli-cmds.c | 2 +- gdb/cli/cli-decode.c | 89 +++++++++++++++++++---------------- gdb/cli/cli-decode.h | 3 ++ gdb/testsuite/gdb.base/completion.exp | 4 +- gdb/testsuite/gdb.base/default.exp | 36 +++++++------- gdb/testsuite/gdb.btrace/cpu.exp | 4 +- gdb/testsuite/gdb.cp/maint.exp | 2 +- gdb/testsuite/lib/gdb.exp | 4 +- gdb/top.c | 6 +-- 9 files changed, 80 insertions(+), 70 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 0140c717ca2bf2afef83325492eb8e779b6ae919..84478228eec7a7cbd595619a45a4ab4f341c323e 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -215,7 +215,7 @@ error_no_arg (const char *why) static void info_command (const char *arg, int from_tty) { - help_list (infolist, "info ", all_commands, gdb_stdout); + help_list (infolist, "info", all_commands, gdb_stdout); } /* See cli/cli-cmds.h. */ diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 4fbbfcb6aeb9fd8709d6c235d103d7d23c30af8e..96b7d1986aa502b92d24a3a9d58d2ed92acd580c 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -127,8 +127,10 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd, cmd->completer_handle_brkchars = func; } +/* See cli-decode.h. */ + std::string -cmd_list_element::prefixname () const +cmd_list_element::prefixname_no_space () const { if (!this->is_prefix ()) /* Not a prefix command. */ @@ -136,14 +138,27 @@ cmd_list_element::prefixname () const std::string prefixname; if (this->prefix != nullptr) - prefixname = this->prefix->prefixname (); + { + prefixname = this->prefix->prefixname_no_space (); + prefixname += " "; + } prefixname += this->name; - prefixname += " "; return prefixname; } +/* See cli-decode.h. */ + +std::string +cmd_list_element::prefixname () const +{ + std::string result = prefixname_no_space (); + if (!result.empty ()) + result += " "; + return result; +} + /* See cli/cli-decode.h. */ std::vector @@ -380,7 +395,7 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c) while (c->is_alias ()) c = c->alias_target; - help_list (*c->subcommands, c->prefixname ().c_str (), + help_list (*c->subcommands, c->prefixname_no_space ().c_str (), all_commands, gdb_stdout); } @@ -1803,7 +1818,7 @@ help_cmd (const char *command, struct ui_file *stream) /* If this is a prefix command, print it's subcommands. */ if (c->is_prefix ()) - help_list (*c->subcommands, c->prefixname ().c_str (), + help_list (*c->subcommands, c->prefixname_no_space ().c_str (), all_commands, stream); /* If this is a class name, print all of the commands in the class. */ @@ -1824,54 +1839,48 @@ help_cmd (const char *command, struct ui_file *stream) c->hook_post->name); } -/* - * Get a specific kind of help on a command list. - * - * LIST is the list. - * CMDTYPE is the prefix to use in the title string. - * THECLASS is the class with which to list the nodes of this list (see - * documentation for help_cmd_list below), As usual, ALL_COMMANDS for - * everything, ALL_CLASSES for just classes, and non-negative for only things - * in a specific class. - * and STREAM is the output stream on which to print things. - * If you call this routine with a class >= 0, it recurses. - */ +/* Get a specific kind of help on a command list. + + LIST is the list. + CMDTYPE is the prefix to use in the title string. It should not + end in a space. + THECLASS is the class with which to list the nodes of this list (see + documentation for help_cmd_list below), As usual, ALL_COMMANDS for + everything, ALL_CLASSES for just classes, and non-negative for only things + in a specific class. + and STREAM is the output stream on which to print things. + If you call this routine with a class >= 0, it recurses. */ void help_list (struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream) { - int len; - char *cmdtype1, *cmdtype2; - - /* If CMDTYPE is "foo ", CMDTYPE1 gets " foo" and CMDTYPE2 gets "foo sub". - */ - len = strlen (cmdtype); - cmdtype1 = (char *) alloca (len + 1); - cmdtype1[0] = 0; - cmdtype2 = (char *) alloca (len + 4); - cmdtype2[0] = 0; - if (len) + int len = strlen (cmdtype); + const char *space = ""; + const char *prefix = ""; + if (len > 0) { - cmdtype1[0] = ' '; - memcpy (cmdtype1 + 1, cmdtype, len - 1); - cmdtype1[len] = 0; - memcpy (cmdtype2, cmdtype, len - 1); - strcpy (cmdtype2 + len - 1, " sub"); + prefix = "sub"; + space = " "; } if (theclass == all_classes) - gdb_printf (stream, "List of classes of %scommands:\n\n", cmdtype2); + gdb_printf (stream, "List of classes of %scommands:\n\n", + prefix); + else if (len == 0) + gdb_printf (stream, "List of commands:\n\n"); else - gdb_printf (stream, "List of %scommands:\n\n", cmdtype2); + gdb_printf (stream, "List of \"%ps\" %scommands:\n\n", + styled_string (command_style.style (), cmdtype), + prefix); help_cmd_list (list, theclass, theclass >= 0, stream); if (theclass == all_classes) { gdb_printf (stream, "\n\ -Type \"%p[help%s%p]\" followed by a class name for a list of commands in ", +Type \"%p[help%s%s%p]\" followed by a class name for a list of commands in ", command_style.style ().ptr (), - cmdtype1, + space, cmdtype, nullptr); stream->wrap_here (0); gdb_printf (stream, "that class."); @@ -1881,9 +1890,9 @@ Type \"%ps\" for the list of all commands.", styled_string (command_style.style (), "help all")); } - gdb_printf (stream, "\nType \"%p[help%s%p]\" followed by %scommand name ", - command_style.style ().ptr (), cmdtype1, nullptr, - cmdtype2); + gdb_printf (stream, "\nType \"%p[help%s%s%p]\" followed by %scommand name ", + command_style.style ().ptr (), space, cmdtype, nullptr, + prefix); stream->wrap_here (0); gdb_puts ("for ", stream); stream->wrap_here (0); diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index ec73c11d17248ffae810b05a592965de8295b371..d726fa0f74216788df7d7f171e287a0a0e366966 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -83,6 +83,9 @@ struct cmd_list_element For non-prefix commands, return an empty string. */ std::string prefixname () const; + /* Like prefixname, but do not append a trailing space. */ + std::string prefixname_no_space () const; + /* Return a vector of strings describing the components of the full name of this command. For example, if this command is 'set AA BB CC', then the vector will contain 4 elements 'set', 'AA', 'BB', and 'CC' diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index aea18de9e3f87b43fd2e6ce111e1f1d0728e6cf5..571d714b710eaa033c88ffc3b87f61ac39beacd5 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -311,7 +311,7 @@ gdb_test_multiple "" "$test" { -re "^info $" { send_gdb "\n" gdb_test_multiple "" "$test" { - -re "List of info subcommands.*$gdb_prompt $" { + -re "List of \"info\" subcommands.*$gdb_prompt $" { pass "$test" } } @@ -324,7 +324,7 @@ gdb_test_multiple "" "$test" { -re "^info \\\x07$" { send_gdb "\n" gdb_test_multiple "" "$test" { - -re "List of info subcommands:\r\n\r\n.*$gdb_prompt $" { + -re "List of \"info\" subcommands:\r\n\r\n.*$gdb_prompt $" { pass "$test" } } diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index bbc95aa0539b86463d9b42c8a7748a6e215161a3..c402249905e9dbc54cc3d410c12324047b366b11 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -28,8 +28,8 @@ set timeout 60 gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" # test append -gdb_test "append" "List of append subcommands:.*" -gdb_test "append binary" "List of append binary subcommands:.*" +gdb_test "append" "List of \"append\" subcommands:.*" +gdb_test "append binary" "List of \"append binary\" subcommands:.*" gdb_test "append memory" "Missing filename\." gdb_test "append value" "Missing filename\." gdb_test "append binary memory" "Missing filename\." @@ -76,7 +76,7 @@ gdb_test "call" "The history is empty..*" #test catch -gdb_test "catch" "List of catch subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help catch\" followed by catch subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "catch" "List of \"catch\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help catch\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test cd gdb_test "cd" "Working directory \[^\r\n\]*\(\r\n \\(canonically \[^\r\n\]*\\)\)?\\." @@ -145,12 +145,12 @@ gdb_test "down" "No stack.*" #test down-silently gdb_test "down-silently" "No stack." # test dump -gdb_test "dump" "List of dump subcommands:.*" -gdb_test "dump binary" "List of dump binary subcommands:.*" -gdb_test "dump ihex" "List of dump ihex subcommands:.*" +gdb_test "dump" "List of \"dump\" subcommands:.*" +gdb_test "dump binary" "List of \"dump binary\" subcommands:.*" +gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*" gdb_test "dump memory" "Missing filename\." -gdb_test "dump srec" "List of dump srec subcommands:.*" -gdb_test "dump tekhex" "List of dump tekhex subcommands:.*" +gdb_test "dump srec" "List of \"dump srec\" subcommands:.*" +gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*" gdb_test "dump value" "Missing filename\." gdb_test "dump binary memory" "Missing filename\." gdb_test "dump binary value" "Missing filename\." @@ -251,9 +251,9 @@ gdb_test "help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Use #test handle gdb_test "handle" "Argument required .signal to handle.*" #test info "i" abbreviation -gdb_test "i" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation" +gdb_test "i" "List of \"info\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation" #test info -gdb_test "info" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "info" "List of \"info\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test ignore gdb_test "ignore" "Argument required .a breakpoint number.*" #test info address @@ -456,7 +456,7 @@ gdb_test "nexti" "The program is not being run." gdb_test "output" "Argument required .expression to compute.*" #test overlay -gdb_test "overlay" "List of overlay subcommands:.*" +gdb_test "overlay" "List of \"overlay\" subcommands:.*" #test a non-existant overlay subcommand gdb_test "overlay on" "Undefined overlay command.* Try \"help overlay\"." gdb_test_no_output "overlay manual" "overlay manual #1" @@ -553,7 +553,7 @@ gdb_test_no_output "set args" "set args" # Test set check abbreviations foreach x {"c" "ch" "check"} { - gdb_test "set $x" "List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \ + gdb_test "set $x" "List of \"set check\" subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \ "set check \"$x\" abbreviation" } @@ -583,17 +583,17 @@ gdb_test_no_output "set history save" "set history save" #test set history size gdb_test "set history size" "Argument required .integer to set it to.*" #test set history -gdb_test "set history" "List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "set history" "List of \"set history\" subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test set language gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust." #test set listsize gdb_test "set listsize" "Argument required .integer to set it to.*" #test set print "p" abbreviation -gdb_test "set p" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation" +gdb_test "set p" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation" #test set print "pr" abbreviation -gdb_test "set pr" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation" +gdb_test "set pr" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation" #test set print -gdb_test "set print" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "set print" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test set print address gdb_test_no_output "set print address" "set print address" #test set print array @@ -882,7 +882,7 @@ gdb_expect { } #test target -gdb_test "target" "List of target subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help target\" followed by target subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "target" "List of \"target\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help target\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test tbreak gdb_test "tbreak" "No default breakpoint address now." #test thread @@ -915,7 +915,7 @@ gdb_test "unset environment" \ "y" #test unset -gdb_test "unset" "List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." +gdb_test "unset" "List of \"unset\" subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." #test up #test up-silently gdb_test "up-silently" "No stack." diff --git a/gdb/testsuite/gdb.btrace/cpu.exp b/gdb/testsuite/gdb.btrace/cpu.exp index 8b830a5d4abeafc5c8d6d3148002c2689b829e84..26ffa09581feac3d9c4e972bc730612afe2f9d08 100644 --- a/gdb/testsuite/gdb.btrace/cpu.exp +++ b/gdb/testsuite/gdb.btrace/cpu.exp @@ -42,9 +42,9 @@ proc test_junk { arg junk current } { gdb_test "show record btrace cpu" "btrace cpu is 'auto'\." "default cpu" gdb_test "set record" \ - "List of set record subcommands.*" + "List of \"set record\" subcommands.*" gdb_test "set record btrace" \ - "List of set record btrace subcommands.*" + "List of \"set record btrace\" subcommands.*" test_bad "" "auto" test_good "intel: 0/0" diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp index e53643429f4cc1f1c4a76f9d34a43c8337371e3b..abd59314fff06357ddf98d304fdfc802c9294b5f 100644 --- a/gdb/testsuite/gdb.cp/maint.exp +++ b/gdb/testsuite/gdb.cp/maint.exp @@ -32,7 +32,7 @@ proc test_help {} { "C\\+\\+ maintenance commands.\r\n\r\n" } - set multiple_help_body "List of maintenance cplus subcommands:.*Command name abbreviations are allowed if unambiguous." + set multiple_help_body "List of \"maintenance cplus\" subcommands:.*Command name abbreviations are allowed if unambiguous." gdb_test "maint cp" $multiple_help_body diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7ee2043f0f88602f64943e5083be2566b1f33692..8c4a66a8a9aa14145fcca84cce38fd901771bc88 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -8701,8 +8701,8 @@ proc test_prefix_command_help { command_list expected_initial_lines args } { # Use 'list' and not just {} because we want variables to # be expanded in this list. set l_stock_body [list\ - "List of $full_command subcommands\:.*\[\r\n\]+"\ - "Type \"help $full_command\" followed by $full_command subcommand name for full documentation\.\[\r\n\]+"] + "List of \"$full_command\" subcommands\:.*\[\r\n\]+"\ + "Type \"help $full_command\" followed by subcommand name for full documentation\.\[\r\n\]+"] set l_entire_body [concat $expected_initial_lines $l_stock_body $help_list_trailer] if {[llength $args]>0} { help_test_raw "help ${command}" $l_entire_body [lindex $args 0] diff --git a/gdb/top.c b/gdb/top.c index bcaf4dc6a55707b01086fd2eebedf668a1455d74..034aa08e6ff15e2b91e09608021deaf2c44997e2 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -549,12 +549,10 @@ execute_command (const char *p, int from_tty) that can be followed by its args), report the list of subcommands. */ { - std::string prefixname = c->prefixname (); - std::string prefixname_no_space - = prefixname.substr (0, prefixname.length () - 1); + std::string prefixname = c->prefixname_no_space (); gdb_printf ("\"%s\" must be followed by the name of a subcommand.\n", - prefixname_no_space.c_str ()); + prefixname.c_str ()); help_list (*c->subcommands, prefixname.c_str (), all_commands, gdb_stdout); } From patchwork Sun Jan 12 12:04:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 104608 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6EF23857810 for ; Sun, 12 Jan 2025 12:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6EF23857810 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=rD2vOMcu X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id C74B93858432 for ; Sun, 12 Jan 2025 12:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C74B93858432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C74B93858432 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; cv=none; b=u7pf1dQM8koHJRJl6DFLhgDXEwGRGBeQkd/x1PE6ccrL+yKB9WsWOTubAHv+0DcO2iHrkq/ZMRZlHRUqwuybCuFEPanin0fjRJOjhubrU4m5Ypbv+dzSXFOxwKpCdNhAPHL8Stu/Y/+xuYxgjP0vNuatn0SdZvAd2giVRSt/s4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; c=relaxed/simple; bh=Gsi128RMOxfrjRvAfv0WXpufQf22U26HkWq2qCX8Ka8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rTHPV5fJ/c2ntqfiQZHNi8xdjUqVJRm+tznYLr75ocAZcsB3hVAzIHpzTV10Q9eNGQZEcDZ7y7CzWU3vDduDpc174DPD1TG7wiHq0g0PXPVBEVuL5264ytc04UipbvacDZZznYy49pXqdDES3WvjJDyytXKRHv0LRZWl/03lFl0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C74B93858432 Received: from eig-obgw-6008a.ext.cloudfilter.net ([10.0.30.227]) by cmsmtp with ESMTPS id WstAtD74Sdz4NWwhMta5cU; Sun, 12 Jan 2025 12:04:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id WwhLtTwgiEzLqWwhLtsilM; Sun, 12 Jan 2025 12:04:07 +0000 X-Authority-Analysis: v=2.4 cv=XrX8O0F9 c=1 sm=1 tr=0 ts=6783afb7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=VdSt8ZQiCzkA:10 a=ItBw4LHWJt0A:10 a=hSKR3ATKOvzw1NKbuRMA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Y+tIvA8VAWeLYWX512/VzCOTde4/7/OpgeI2YRRku/M=; b=rD2vOMcuLAtofSTSWrTsTRejGS mvYKus/X2JxwH6xueg8hXR/G35jK+3Si+B5NTAOXRHVgpyKv0UdvfkXvqcIrPfLSuvFN9bvo9bdQK aVSmkiLJ8dINsNUcf3xpNLpe7; Received: from 97-118-36-154.hlrn.qwest.net ([97.118.36.154]:46946 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1tWwhL-00212c-0R; Sun, 12 Jan 2025 05:04:07 -0700 From: Tom Tromey Date: Sun, 12 Jan 2025 05:04:00 -0700 Subject: [PATCH 3/4] Remove "enabled" output from show_index_cache_command MIME-Version: 1.0 Message-Id: <20250112-submit-help-list-style-title-v1-3-9457a2686440@tromey.com> References: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> In-Reply-To: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.36.154 X-Source-L: No X-Exim-ID: 1tWwhL-00212c-0R X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-36-154.hlrn.qwest.net (prentzel.local) [97.118.36.154]:46946 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfGH1ltG3DSoL0dd1LIe9MR+U2X7ypObsCn/QP6NRYkwKlYMQc+qSh0Ry8mbhtOTUPRSfYPFMkGB6podm2ZWOHAo+rRG1nFCHdYCf1o5713RMet5gWxy2 qU40v8ERVBJ5p++Qtz6e+/Xx9IVNXGiVL1dfet2Y9k9w3HeM1dwUA52Urtk9iajj1fnnGWhpZtf8KGc5DbYezxrYhBwDUXXTeTE= X-Spam-Status: No, score=-3019.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org show_index_cache_command prints whether the index-cache is enabled. This text was added back in 2018 in commit 87d6a7aa (Add DWARF index cache). Then in 2021, the enabling option was changed via commit 7bc5c369 (gdb: introduce "set index-cache enabled", deprecate "set index-cache on/off"). This latter change made this output, IMO, redundant. That is, currently gdb will show: (gdb) show index-cache ... index-cache enabled: The index cache is off. ... The index cache is currently disabled. This patch removes the redundant output. --- gdb/dwarf2/index-cache.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c index a04d5d662d883f582064c7df17e76b8b619d9a58..d34abf373f8a5b15efdcf3c847b27b39b71e4c7b 100644 --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c @@ -280,11 +280,6 @@ show_index_cache_command (const char *arg, int from_tty) /* Call all "show index-cache" subcommands. */ cmd_show_list (show_index_cache_prefix_list, from_tty); - - gdb_printf ("\n"); - gdb_printf - (_("The index cache is currently %s.\n"), - global_index_cache.enabled () ? _("enabled") : _("disabled")); } /* "set/show index-cache enabled" set callback. */ From patchwork Sun Jan 12 12:04:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 104609 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 411FF385782C for ; Sun, 12 Jan 2025 12:08:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 411FF385782C Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=T20CE2Jc X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id D5B0D385780D for ; Sun, 12 Jan 2025 12:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D5B0D385780D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D5B0D385780D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; cv=none; b=jsTVVhEiaIn6iSuVcGHFBmqwMo3ECLJfPrbW1QFoLasm+mMQtu34urzPaRMDUfiTIKMZw/D/7ElN4cWZtxVqTO8nKJXXvDp7awLP4RbJyOhzguwsnOK6YEon8OREVHqlAd8BQ9pVBR8VP7GuvuvCfIdWVtFqPW/Rk1tZI+tDRpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736683448; c=relaxed/simple; bh=w0/oF3Ea33hqQcojZGOMZJraZbXqwBzZS8OJ++o4k7M=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=JF1RwPF3GSC9T4NjJE4m76pVTMwFpiJ6dSKdKepBjuHRR2rhTuZiJRJTaTBSWPxA6H6Nc3jxH6vzMWW5ZUhU5HyS6lEecmONEIFeV86Xde4NooCpep6GqYH1M6mgCh3kPoe68xQ8XpdK/DAKyij79niL9NRwiVngp7C721GlvLk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5B0D385780D Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id WstBt79MEjMK7WwhMtwRfZ; Sun, 12 Jan 2025 12:04:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id WwhLtTBo42Zy0WwhMt7xs8; Sun, 12 Jan 2025 12:04:08 +0000 X-Authority-Analysis: v=2.4 cv=Q4EZ4J2a c=1 sm=1 tr=0 ts=6783afb8 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=VdSt8ZQiCzkA:10 a=ItBw4LHWJt0A:10 a=sTqVu5C8U_3e8XfWFJYA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kMtX2Owoe9dnHuAF2MB85gUcsdi7dNkQQGyWdjCivqg=; b=T20CE2JcsLpbncpdCuJ/vhWrR9 r9gviEWqbVXCXm9fiKDyh8r0EzAJm9ig9zZnlBZetZuJZSGPFCallu/XuT3E2966qrRQlNjSPv1Od tITefxDc61yaFKB2dXgiANtss; Received: from 97-118-36-154.hlrn.qwest.net ([97.118.36.154]:46946 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1tWwhL-00212c-1D; Sun, 12 Jan 2025 05:04:07 -0700 From: Tom Tromey Date: Sun, 12 Jan 2025 05:04:01 -0700 Subject: [PATCH 4/4] Use command style in cmd_show_list MIME-Version: 1.0 Message-Id: <20250112-submit-help-list-style-title-v1-4-9457a2686440@tromey.com> References: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> In-Reply-To: <20250112-submit-help-list-style-title-v1-0-9457a2686440@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.36.154 X-Source-L: No X-Exim-ID: 1tWwhL-00212c-1D X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-36-154.hlrn.qwest.net (prentzel.local) [97.118.36.154]:46946 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPB5eXR449T8Kw5Jt1YdO5Ic1cIzRDCxVFcIDDbjKBMPTirKGQ7Jz6camu8Z0yVx0P/je5/O8MK+3yTYnwM+ve09OtYlKqux3o1/pDTPCp14cdr44nhl S8lCvSQl6GtAXuFpZNyR+1LkB+2lK4Ph+gYI9ROZ7IREcrLBHfuTBVXOD98UG7uiSn+DP6XP0ezj0xpfJ+9SPEVuiAwQWN1kW3g= X-Spam-Status: No, score=-3019.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org cmd_show_list is a bit funny because it shows partial command names -- for a command like "show abc xyz", it will only show "abc xyz". Nevertheless, I think it makes some sense to highlight these with the command style. That is what this patch does. --- gdb/auto-load.c | 4 ++-- gdb/cli/cli-setshow.c | 15 ++++++++++----- gdb/remote.c | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gdb/auto-load.c b/gdb/auto-load.c index a8f3a8d5fdd474b190a2f419f93487594019a883..71bbae4fc1d436c7ee593a47122f1e5145eef43f 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1472,7 +1472,7 @@ info_auto_load_cmd (const char *args, int from_tty) struct ui_out *uiout = current_uiout; ui_out_emit_tuple tuple_emitter (uiout, "infolist"); - + const ui_file_style cmd_style = command_style.style (); for (list = *auto_load_info_cmdlist_get (); list != NULL; list = list->next) { ui_out_emit_tuple option_emitter (uiout, "option"); @@ -1480,7 +1480,7 @@ info_auto_load_cmd (const char *args, int from_tty) gdb_assert (!list->is_prefix ()); gdb_assert (list->type == not_set_cmd); - uiout->field_string ("name", list->name); + uiout->field_string ("name", list->name, cmd_style); uiout->text (": "); cmd_func (list, auto_load_info_scripts_pattern_nl, from_tty); } diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index bcc793b3148035ae825696f31c42bb3811656eb7..b03d20cdb63b2a0528e886e3c33c06da549660f4 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -27,6 +27,7 @@ #include "cli/cli-decode.h" #include "cli/cli-cmds.h" #include "cli/cli-setshow.h" +#include "cli/cli-style.h" #include "cli/cli-utils.h" /* Return true if the change of command parameter should be notified. */ @@ -681,6 +682,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty) struct ui_out *uiout = current_uiout; ui_out_emit_tuple tuple_emitter (uiout, "showlist"); + const ui_file_style cmd_style = command_style.style (); for (; list != NULL; list = list->next) { /* We skip show command aliases to avoid showing duplicated values. */ @@ -701,15 +703,18 @@ cmd_show_list (struct cmd_list_element *list, int from_tty) { ui_out_emit_tuple option_emitter (uiout, "option"); - if (list->prefix != nullptr) + if (!uiout->is_mi_like_p () && list->prefix != nullptr) { /* If we find a prefix, output it (with "show " skipped). */ std::string prefixname = list->prefix->prefixname (); - prefixname = (!list->prefix->is_prefix () ? "" - : strstr (prefixname.c_str (), "show ") + 5); - uiout->text (prefixname); + if (startswith (prefixname, "show ")) + prefixname = prefixname.substr (5); + /* In non-MI mode, we include the full name here. */ + prefixname += list->name; + uiout->field_string ("name", prefixname, cmd_style); } - uiout->field_string ("name", list->name); + else + uiout->field_string ("name", list->name, cmd_style); uiout->text (": "); if (list->type == show_cmd) do_show_command (NULL, from_tty, list); diff --git a/gdb/remote.c b/gdb/remote.c index 79d91d6251ab1b0ba6c314b022c188c36fbc455c..1aff6ab54d315ee900534fd101794b7a73474018 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -15582,6 +15582,7 @@ show_remote_cmd (const char *args, int from_tty) struct ui_out *uiout = current_uiout; ui_out_emit_tuple tuple_emitter (uiout, "showlist"); + const ui_file_style cmd_style = command_style.style (); for (; list != NULL; list = list->next) if (strcmp (list->name, "Z-packet") == 0) continue; @@ -15593,7 +15594,7 @@ show_remote_cmd (const char *args, int from_tty) { ui_out_emit_tuple option_emitter (uiout, "option"); - uiout->field_string ("name", list->name); + uiout->field_string ("name", list->name, cmd_style); uiout->text (": "); if (list->type == show_cmd) do_show_command (NULL, from_tty, list);