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);