From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +SBNOeuLSWiiqgkAWB0awg (envelope-from ) for ; Wed, 11 Jun 2025 10:00:11 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=ODSq/6iR; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DCBB01E11C; Wed, 11 Jun 2025 10:00:11 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 394BC1E089 for ; Wed, 11 Jun 2025 10:00:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB9663858D35 for ; Wed, 11 Jun 2025 14:00:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB9663858D35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=ODSq/6iR Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by sourceware.org (Postfix) with ESMTPS id E30173858CD1 for ; Wed, 11 Jun 2025 13:58:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E30173858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E30173858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749650329; cv=none; b=FoOv/fEetWSVrUxQ+G7rDxIu7PLHzLhFOdUysGQxVd/QVCRUy1IO83xlqknCSlRjtj4CRDvLldtbBEHdGBYfQCpmsAUGA6TDPPjlxfJ2TwSPaKv/cFYMkJ0yk8RP+T9p8udF7SqrTh+DsNWNTYkZNb4P8wCmndAdNEOMdUSAk2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749650329; c=relaxed/simple; bh=IETMncnBVeCesi9jWcKhQs969EQdgz/RaUBCVGbw2lA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=EkvmmwAB2r2o5z15W7NykqOgo7W6fJ5wBRqeHjdVF3IETvEhd+qm6/9u86PW7TdpMhdkOYw4/r8Te2j5cmN3szLRDJPdU8G5FRQVGRTKb7aibzNib0gaG+lNnTn7WYHRcQCknUVGvkLnlx1MmryLVwEAFRnU1+zOUoHuJ/8ZQgc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E30173858CD1 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-86d0168616aso559357039f.1 for ; Wed, 11 Jun 2025 06:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1749650328; x=1750255128; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2KRyxfkp/tnQMVFygD47sLOJszCQ4sw8PmuFD6jkb3k=; b=ODSq/6iRCxuB0H9KzHbgvM4isgA9i2HAE+ouRm6rPhEDa4qcuw4KRIRaLYVN9EFX+4 NY+KTOGlWFKoQw6leOvvVZLw++1wunm4U1VAkZbzeZNtKqfn8gGv3dM9yuDacrfkWNQ9 R8JvDvmBlFUAE+/dFAj6reXjAzYo+Hvt3IGnF4hMdZJL2q+HKPUPNRSXhScXgNbhHSGd zhALEBRUYnvOHxsJC4o9MYJvjbLIORbqmHRoj8JiVZCsJR4uah08PMSd8ri2RsThzBNg XrKo1EvOsN0GGmoib9YkmYo2sYIqzUaerPyph7/KcTXbXCwE1IVBfG/hlLtYN13+N0/d 8B/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749650328; x=1750255128; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2KRyxfkp/tnQMVFygD47sLOJszCQ4sw8PmuFD6jkb3k=; b=m8vHrGPV/lWmGsvb0Y2lujN1Ius1PONYVebV4qmgdg3yJJc4wYA5sWGyeuGuMHO/qS iho31qYZ5wp3N88VLTPPt7U1Y33/1D8K6Y6vtySS1nI5NO5mH3OK02yeuPat06V5wUiL 4r8PWo+W4R5u8RuIw/W0W/pCz9v6DPvbS8U9aNLCgB386Zl35RDEyv/8cR/i4tmg64Hx LO4DTvIjJKLxOABxxjL10fPlRfGxeOz62TeimPmwXA38maZBDtdlovAGXB/db1cDInSq joeVO+0eBsbyCPocGnXnN1+2fHnrM7C+cGgq3IStblMJV2mjZFiAiz6otCc9db7XHKya k4vg== X-Gm-Message-State: AOJu0Ywt0L7P8ADhqI6DCtxSvzNEid3HpCEudJPyfoQ9q2fuv39TmmKy VMrGFhAxJG7P9umoo2h2RGY2XXQnMO/xpO9ol8w1QGMYoW/9WJfvWAFLM9ujnTp3/g== X-Gm-Gg: ASbGncsrkuwZu4MHyfa/lTWbjniJrzwf5t07A994sPN7ciCWL0obyUHsi2eLX00CJ5R +GTpzO3RvcpE8V0yHObyYytOwzEyqmga7JyQ5yhOjfaEirTsx2WaddW1+mU+96+kP2Hj0cVjHUh xy1nL7VIMFfmEdv7m/iu27n62mD1Hf2EWCdeJlUeItqRp2tJQdl75DJ9RLXo5sQ5Ggj3Dmp/bzV 1/W8DmGI5Ns0J+b1GrsadJcuk8ej8kJHuaiFt1o+oZKN6HyKzaxNsQZIiS2Ub36QBmMv257i+z1 6p1ZhJYOFizbMBrwm82ShWq872HQxH0pOqhRN8B4yOc4X89Y8AwFzxI8Fr7YVzRGc6eXTIO5ft5 BVr7PEAKzm1JyKANjs7I= X-Google-Smtp-Source: AGHT+IEWEl/uLfWTfw8o5OO+mTJxOeKLu/TS/ehUU50x9tc4IgxE3DXcxtXnGW/802pdATmxF7o/zw== X-Received: by 2002:a05:6602:4c0d:b0:85b:3c49:8811 with SMTP id ca18e2360f4ac-875bc3965b0mr440037039f.4.1749650327959; Wed, 11 Jun 2025 06:58:47 -0700 (PDT) Received: from [192.168.0.26] (75-166-228-225.hlrn.qwest.net. [75.166.228.225]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-875bc5b72b6sm40713139f.16.2025.06.11.06.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 06:58:47 -0700 (PDT) From: Tom Tromey Date: Wed, 11 Jun 2025 07:58:44 -0600 Subject: [PATCH v2 2/2] Allow check-mark to be changed for CLI MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20250611-emoji-check-mark-v2-2-d299ec101650@adacore.com> References: <20250611-emoji-check-mark-v2-0-d299ec101650@adacore.com> In-Reply-To: <20250611-emoji-check-mark-v2-0-d299ec101650@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey , Eli Zaretskii X-Mailer: b4 0.14.2 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~public-inbox=simark.ca@sourceware.org In keeping with the emojification of gdb, this patch changes the default "current" marker to be a check-mark. It adds a knob to allow the character to be changed, and, as always, reverts to the old output when emojis are disabled. Reviewed-By: Eli Zaretskii --- gdb/NEWS | 6 ++++++ gdb/cli-out.c | 8 ++++++++ gdb/cli-out.h | 2 ++ gdb/cli/cli-style.c | 31 +++++++++++++++++++++++++++++++ gdb/cli/cli-style.h | 3 +++ gdb/doc/gdb.texinfo | 12 ++++++++++++ gdb/testsuite/gdb.base/style.exp | 4 ++++ 7 files changed, 66 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 4dcc344b07278654b1d54ca71db6749d62890d01..fd2e909595132927ed0c2eb9e5739824f5d9942a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -78,6 +78,12 @@ set style error-prefix STRING with emoji display, and so the prefixes are only displayed if emoji styling is enabled. +set style check-mark STRING + Set the string that is used to indicate the "current" row when a + table is printed by the CLI. This functionality is intended for use + with emoji display, and so the prefixes are only displayed if emoji + styling is enabled. + info linker-namespaces info linker-namespaces [[N]] Print information about the given linker namespace (identified as N), diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 27a82f607eb3d6abcd9867880e99f824a0392312..c619bb4243dbfe4bdc0fb442e7496aa066b52575 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -421,6 +421,14 @@ cli_ui_out::do_progress_end () m_progress_info.pop_back (); } +/* See ui-out.h. */ + +const char * +cli_ui_out::get_check_mark () +{ + return ::get_check_mark (); +} + /* local functions */ void diff --git a/gdb/cli-out.h b/gdb/cli-out.h index c761dacc9a83cf5ffadfca2ee4751a37c2159402..342f2d0a15fb1d3823214d2f946f4ac10ca9346d 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -81,6 +81,8 @@ class cli_ui_out : public ui_out double, double) override; virtual void do_progress_end () override; + const char *get_check_mark () override; + bool suppress_output () { return m_suppress_output; } diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index e6441277d05f5215ecf3f04a8c82be65d9fd031d..831f5051ee03aa8eae7c1f23ca6faa496052d538 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -494,6 +494,29 @@ print_error_prefix (ui_file *file) gdb_puts (error_prefix.c_str (), file); } +/* Emoji check-mark. */ +static std::string check_mark = "✔️"; + +/* Implement 'show style check-mark'. */ + +static void +show_check_mark (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + gdb_printf (file, _("Check mark is \"%s\".\n"), + check_mark.c_str ()); +} + +/* See cli-style.h. */ + +const char * +get_check_mark () +{ + if (emojis_ok ()) + return check_mark.c_str (); + return "*"; +} + void _initialize_cli_style (); void _initialize_cli_style () @@ -737,4 +760,12 @@ The error prefix text is displayed before any error, when\n\ emoji output is enabled."), nullptr, show_error_prefix, &style_set_list, &style_show_list); + add_setshow_string_cmd ("check-mark", no_class, + &check_mark, + _("Set the check mark string."), + _("Show the check mark string."), + _("\ +The check mark is the string used to indicate the current line in a table."), + nullptr, show_check_mark, + &style_set_list, &style_show_list); } diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index b1a950a539cb8eaf5381f3ea546ee9fa3e87500b..7b88424d972303b592149499985e7d868494be03 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -204,4 +204,7 @@ extern void print_warning_prefix (ui_file *file); /* Print the error prefix, if desired. */ extern void print_error_prefix (ui_file *file); +/* Return the current check mark string. */ +extern const char *get_check_mark (); + #endif /* GDB_CLI_CLI_STYLE_H */ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7d06e1f5fa4eb1fc348f8b22a90f79f019ae5e6b..916caced26cb86b14fa9fed9c03f0fd70a78ad5b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -28022,6 +28022,18 @@ emoji display, and so the prefixes are only displayed if emoji styling is enabled. The defaults are the warning sign emoji for warnings, and and the cross mark emoji for errors. +@item set style check-mark @var{string} +@itemx show style check-mark +These commands control the string that the CLI uses to indicate which +line in a table indicates the current state of @value{GDBN}. For +example, this would be used to indicate the current thread in the +output of @samp{info threads}. This functionality is intended for use +with emoji display, and so the chosen string is only displayed if +emoji styling is enabled. The default is a check mark character; with +the non-emoji fallback being an asterisk. Note that @value{GDBN} will +not adjust the column widths of the table, so normally this should +only be set to a single character. + @item set style tui-current-position @samp{on|off} Enable or disable styling of the source and assembly code highlighted by the TUI's current position indicator. The default is @samp{off}. diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index c10be3bc12aa10f5a13856cb14f7fad86f32ff90..9f2a288e953f0711d698673e723d6192c3862d79 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -341,6 +341,10 @@ proc run_style_tests { } { gdb_test "maint translate-address" \ "abcd:requires argument.*" \ "error prefix" + + gdb_test_no_output "set style check-mark @" + gdb_test "info inferior" "\r\n@ 1 .*" + gdb_test "show style check-mark" "Check mark is \"@\"\\." } } -- 2.49.0