From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yMuaK0ljHmiWJhwAWB0awg (envelope-from ) for ; Fri, 09 May 2025 16:19:21 -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=Qr2bOVva; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AAF331E10E; Fri, 9 May 2025 16:19:21 -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 EA32D1E089 for ; Fri, 9 May 2025 16:19:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A797A385734D for ; Fri, 9 May 2025 20:19:20 +0000 (GMT) Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id 58549385800F for ; Fri, 9 May 2025 20:18:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58549385800F 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 58549385800F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746821935; cv=none; b=ad9NS/FeO2GCC5aOzq7wdQZAiCq7mzs5Q159H/GHaJ4ufbcSybtQt5Bn35biiKbYPDJPkqqEyRNjW+A7sf+bYGB7PNIRZZMVdjcDd35oF0cIWCIzTCaUujm+epsR924axSpGBDCvNqknnBqcaVGvPgvksSthDM3JcEvdSpwcFoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746821935; c=relaxed/simple; bh=UuocZRK+qzRs1pfEI0G9NNgQv+pON3UkI95Xz/h5o90=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rKfeYtvE6yGkiq22eZ4jAb6Hi4RNrle1f1lAR9IdIqesroC9+m2ov3Nsq1n9/jPZ1aQ/4tYEDf2/Rlxpog83JqJ8gY7cEs8EagkCqfcI/LA+cJAvr9586d0mfeKzXwuLhWHiA6anGLC/UVyA95IhZjb+LqUCOA9+92SshjCaIJo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-86135af1045so266484639f.1 for ; Fri, 09 May 2025 13:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1746821934; x=1747426734; 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=kgjacRaCFYoYE4c2KIjVGs6Is+Gh2kKIv2N77igd7ZI=; b=Qr2bOVvaSAoi01E9hS5XPK7yv4PqbTL2TLUe9nUL4LDUmRc/hku8nWclhMjKc5094j WMQxLJoWgvNJ95l7zwf1Vgi3C9cw1WwDNvyYVrWwPtSnP7F+MRdZOGe4wdl1OH9Hqegd x8hetffTQ+h/0Q6/6qHgbhHGTmOCWlTpqbIwcX3YZo2sNkXPaCShQ4aQiEgdNk4aPq2H k/xJBw39p/gxp1xGAommYUdpj6s4LVKbnf/3Seio1BxDu4ZCxXr3d+LXIRbFPzFPgM3w iZ3RdtOuHjEWXruZuc9Rs1AvIvni8xjnEPm7lWAXE5t5MtZuEF60KeSYes2vBIhj8P/P M+lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746821934; x=1747426734; 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=kgjacRaCFYoYE4c2KIjVGs6Is+Gh2kKIv2N77igd7ZI=; b=XJXPKPAtZ9SJGVZ35FyEulu5bynmhxQJwVzyq/rKjM3sEKVBwG7z19h9cwWVf57rxz meZmAvMn4Ka7GCSGNWlVx8epTIfM+pd6OxblKJjj7wnk49cGkvBl1iCk7y/vBbM3+126 vyWyPaK3CGR9kGbZf2IND7AzLPAHot7bNCOTGoOjcURAnLBfu9cZPMQsuyIM7TbLq8wZ zraKy4WEVPLcraCVGr1JbKIJWui/E9CjUsVNduoMzyEDes9nED98HVMeCozO/+CucuBW nPqj+x8AEf4vzi2+xv1xXLekke0oezpkJ3oOewncJa9CJTGJOqTdC8m4cxgaHQW/MaWg hxvQ== X-Gm-Message-State: AOJu0Yy5lwm/UIwwFcVm6TA+SPwwsAo16d/veFbbnMVwAhz5iJZdvNH8 wNtjfcsD04kOOCI3Ij27KFo8hWoAoSQ0fSBsWppfkWW7dvKDvYls8M4ts7QyrB293VRNLQZ+/Vw = X-Gm-Gg: ASbGncuGeEzYnjQeqQm5r/nmOmmbdKkxmtuk9kV9rR8YatvhuOFkkebP0QJKwqy4bby P+j4WHS5XnTgiV9447525Zu9FxKyw7TnvOFIeudJvGYPMf4YgmTQC0gbgyXa5fhpwO4Nu7M4s5D yN5ewFpLggIoTahlZwQPHNJ4xh7CSKL1wtXd0I0DuCNXaMndetBENQTujgyo3S0ItrY1jrYDxz/ eLAAI2LR3V/lR/doIoMV0mkjJbwBW3mb3uuZ+DI20f3/1ZOXq8Qygn8soe+bu6DGvy75Gw15TaH yUF78VJIoYp5Ny/AJ0ofz9ZJqXwRZG8uKUEn6WyzMTivgrO1smacaHzdkcpXZtVsCSoHHtQw5DZ wFNdvOA== X-Google-Smtp-Source: AGHT+IFyY9GMP9k07A/LbARM8hEF9vCG/xOrn8XY8TuPJzb9am0A9cbHO12m1C8Jk6tWWANjwXdhOA== X-Received: by 2002:a05:6602:3f83:b0:864:4a82:15ec with SMTP id ca18e2360f4ac-8676354fb18mr679246839f.6.1746821933538; Fri, 09 May 2025 13:18:53 -0700 (PDT) Received: from [192.168.0.26] (97-118-46-156.hlrn.qwest.net. [97.118.46.156]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4fa224a0822sm554143173.23.2025.05.09.13.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 13:18:53 -0700 (PDT) From: Tom Tromey Date: Fri, 09 May 2025 14:18:51 -0600 Subject: [PATCH 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: <20250509-emoji-check-mark-v1-2-63b6c52411f3@adacore.com> References: <20250509-emoji-check-mark-v1-0-63b6c52411f3@adacore.com> In-Reply-To: <20250509-emoji-check-mark-v1-0-63b6c52411f3@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey 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. --- gdb/NEWS | 6 ++++++ gdb/cli-out.c | 8 ++++++++ gdb/cli-out.h | 2 ++ gdb/cli/cli-style.c | 32 ++++++++++++++++++++++++++++++++ gdb/cli/cli-style.h | 3 +++ gdb/doc/gdb.texinfo | 10 ++++++++++ gdb/testsuite/gdb.base/style.exp | 4 ++++ 7 files changed, 65 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index a82b7e3342c57b9b066e9012c5a961ad6ba839f0..07e72833a269ffe0ab034d4c4ea8b185ad217983 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..ea56bbccf255b1a11c1ef4b3dfb7e06c5dc9656e 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,13 @@ 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 text."), + _("Show the check mark text."), + _("\ +The check mark text is displayed in a table to indicate which\n\ +row is currently selected."), + 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 5e5e888cf38cea33a9d7b4e77039207374ec2d5e..539b3cba92d6893dcd843f684b00c91037324c0b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -28014,6 +28014,16 @@ 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 only displayed if emoji +styling is enabled. The default is a check box character; with the +non-emoji fallback being an asterisk. + @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