From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eR5pI0djHmiWJhwAWB0awg (envelope-from ) for ; Fri, 09 May 2025 16:19:19 -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=Vt4v0xs0; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 800A51E10E; Fri, 9 May 2025 16:19:19 -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 AE77A1E089 for ; Fri, 9 May 2025 16:19:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AC00385783C for ; Fri, 9 May 2025 20:19:18 +0000 (GMT) Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 8E37D385840D for ; Fri, 9 May 2025 20:18:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E37D385840D 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 8E37D385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746821933; cv=none; b=FuPxY95kRZ6cqDm54xa9RcjDJIcFjuwyZmkSiT7t1TuuNG/RFoqcNMnwX3YlRW5umm46RFSFswV2YybzIHAHp87iVJ6TxTxEfkSbVTpFoE0hASd40YWvrckStj5fJbvUT04wnlOYtR1nGIx0zx+uN35L6iW718v5lYtI9D3tM/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746821933; c=relaxed/simple; bh=D+yfOjUWsK+1y+bK6+qu+WZK4GY11mlZO2MYpOeVrkQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=BYX29zazaPUpq4MXpnzcZ9cgAP5G/vk+MgFH/KFhSp4UaJ7JP169ft0b+c3jyEYWLqxiVjsxayYbCyB3/sZDF/nBmNQMCNK1y7Z+QnHfT5zn2uJNrC//xC4ZeJs6iGVL8fXnouJKNMTvP46NH4srZSmlbYBEiYZIZbbcNtDx5zQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E37D385840D 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=Vt4v0xs0 Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3d81768268dso23517025ab.3 for ; Fri, 09 May 2025 13:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1746821933; x=1747426733; 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=ceVKsO/dsL+K7k/pWGSbXRiGkpIwAswAhlBk6VqsJN0=; b=Vt4v0xs0hpG0RpVRZ4sIHotjuyL6Y1QEbhIvGWZfQbg+MyjMqWXbjVVMyD/5AUiRiS qNIIQU8j7np0DGUvSoO3R/GLRhgSCgt4Gkvx9ZrlCPrU7lg1HtI5eMwfqdx2i90XLw6Z Ir3QmFkMsMXKYLpr5OnP4trefZDv1pYcNmJnyfLCDdmNe9RFVEEIiUMv2X1cUIHwKBkH jbocK5qoJMRYz5AvOoWihkK/GJvj1Kbp4DHn3JxH60IY3Yeyo68J58x+da2BD9uJ7LY0 Rbw13eDTG2iVn+mNTLD5QRFaQqdorL1YEE/RC0IgwXVh1rL1qBl13Ka0naAjGgWDPMAS c5SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746821933; x=1747426733; 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=ceVKsO/dsL+K7k/pWGSbXRiGkpIwAswAhlBk6VqsJN0=; b=TogB7X8vAt+LX03VhzxMikzErt1NUMCejRu6BMd300uUU3pVAxKEXscY/jISkOIHAw 4f3LE+6g6o3ZKASey+ycf/aN0FfT2PYNqhj9gwLkwXy3SROxTqqZJjmH5uoDFSF5300L QaaRSx3MpnudFWIot4A8lbdF7+TgKpFa9UiR3DgWF6Q7ebMmMttJExr14XEG0tQajVw0 dAvUYuRM950aO1PwNjTs2bPhQr+DIkr93ZqR2tgL4gj0wvXRc9x7b4uADkQQMYiVJ+6O /sKgzgRugmVAoyWsxAolfcQyvK4UvcWvEtOwRd8su4Bybo3+/JGme4dOOCfTH3wizrVF yxAQ== X-Gm-Message-State: AOJu0Yyj9M46bKCYqYsvNtcQDs2YcQvSs9YW8Nl6cj3xphxsQFwL1kDZ X1YPPM2bXYaIFk3Gx27LrcF12YNkYM1CUTfUAb6Fb2WIhNsFKCj+5Nmrwan2Xxj1dcBFdd6pa1w = X-Gm-Gg: ASbGnctnD0iTdYdvkEsRh6IoZ3a9DMHMqGQmahUQuOOaR7G9/dVJA1xJ8zYdA4Fi2nM Hg6w1VFAVXwqICwkaoSxnMDIYp02PEBJmSi8qW7SXLeqWb2urJPEGDQTmAGGVEzw8KtDKNMZz9z yKhEn9qcUgK1IRAMYrObJgepeH8hhXUHWj+9mzJxPLdpHDXT3yBY5efmfTSecNku1GMFIIUDXGd bThdA5dRMPUcOM4iPuCdY/y2nU5sEr5axX62num7xxljqwTSf1kh2cf2JhSqhG/AQrJnxcRsvIl ZpJ5b3+8SoywXkr8Wr2p/SFwcvhBomaVy0s9F79ao2ZJL1fuP4qNHUCgb4IKmHZfm02bLLZqpvT GWScPzA== X-Google-Smtp-Source: AGHT+IGsCNTR3+eZR27S70RwN260YtZ8mEsGXt1CPjs3lABigwbGz9JzTmb1ay6N3vw1R5RpcOQweA== X-Received: by 2002:a05:6e02:1a2e:b0:3d8:1768:242f with SMTP id e9e14a558f8ab-3da7e1e59d8mr62313015ab.2.1746821932474; Fri, 09 May 2025 13:18:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 13:18:51 -0700 (PDT) From: Tom Tromey Date: Fri, 09 May 2025 14:18:50 -0600 Subject: [PATCH 1/2] Introduce ui_out::field_check_mark MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250509-emoji-check-mark-v1-1-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 This adds a new ui_out method, field_check_mark. This method is to be used to indicate the "current" or "selected" row in a table. This patch updates all the relevant tables to call this method. No change should be expected. --- gdb/ada-tasks.c | 5 +---- gdb/inferior.c | 6 +----- gdb/linux-fork.c | 5 +---- gdb/progspace.c | 6 +----- gdb/target-connection.c | 6 ++---- gdb/thread.c | 6 +----- gdb/ui-out.c | 9 +++++++++ gdb/ui-out.h | 13 +++++++++++++ 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 259512377f085423d4feda1a8a67e409109179a2..2f152ec3581f1076110df2ca149a2add5a825e9e 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1163,10 +1163,7 @@ print_ada_task_info (struct ui_out *uiout, /* Print a star if this task is the current task (or the task currently selected). */ - if (task_info->ptid == inferior_ptid) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); + uiout->field_check_mark ("current", task_info->ptid == inferior_ptid); /* Print the task number. */ uiout->field_signed ("id", taskno); diff --git a/gdb/inferior.c b/gdb/inferior.c index e8a28cd2a0e1a4f76946d4fc9c1abdfab08b5d3e..221dbce73d6721f5ed883745c0474e78d94c405d 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -598,11 +598,7 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors) ui_out_emit_tuple tuple_emitter (uiout, NULL); - if (inf == current_inf) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); - + uiout->field_check_mark ("current", inf == current_inf); uiout->field_signed ("number", inf->num); /* Because target_pid_to_str uses the current inferior, diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 338ba032a0e75862d449b9c02c3c61cfc5492dbe..dc50391b22a0ba2d5728d7ae5a4505a73d864fd9 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -849,10 +849,7 @@ print_checkpoints (struct ui_out *uiout, inferior *req_inf, fork_info *req_fi) ui_out_emit_tuple tuple_emitter (uiout, nullptr); - if (is_current && cur_inf == inf) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); + uiout->field_check_mark ("current", is_current && cur_inf == inf); if (print_inf) uiout->field_fmt ("id", "%d.%d", inf->num, fi.num); diff --git a/gdb/progspace.c b/gdb/progspace.c index eda63790aec9169724119c766b7e4c72da3cb550..7f1b0652516f53bd0a69e88fb409887d8639e4c5 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -305,11 +305,7 @@ print_program_space (struct ui_out *uiout, int requested) ui_out_emit_tuple tuple_emitter (uiout, NULL); - if (pspace == current_program_space) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); - + uiout->field_check_mark ("current", pspace == current_program_space); uiout->field_signed ("id", pspace->num); if (pspace->exec_filename () != nullptr) diff --git a/gdb/target-connection.c b/gdb/target-connection.c index 60d7732b56e465ac6fda1164846302e1b9167456..69e5765959ef6bf0bfbc2fb482f5a26fa1a03c79 100644 --- a/gdb/target-connection.c +++ b/gdb/target-connection.c @@ -126,10 +126,8 @@ print_connection (struct ui_out *uiout, const char *requested_connections) ui_out_emit_tuple tuple_emitter (uiout, NULL); - if (current_inferior ()->process_target () == t) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); + uiout->field_check_mark ("current", + current_inferior ()->process_target () == t); uiout->field_signed ("number", t->connection_number); diff --git a/gdb/thread.c b/gdb/thread.c index b659463ef0246992a5290c1eb3b1175094a2e826..2ce94a01efbdfdfb2587d90a160f716171fd63c6 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1122,11 +1122,7 @@ do_print_thread (ui_out *uiout, const char *requested_threads, if (!uiout->is_mi_like_p ()) { - if (tp == current_thread) - uiout->field_string ("current", "*"); - else - uiout->field_skip ("current"); - + uiout->field_check_mark ("current", tp == current_thread); uiout->field_string ("id-in-tg", print_thread_id (tp)); } diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 106a896c07fdadeae6c902a5bd541f81900c6453..a45a7af20d69170fb3ecac62f3f0345395bd88c2 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -557,6 +557,15 @@ ui_out::field_fmt (const char *fldname, const ui_file_style &style, va_end (args); } +void +ui_out::field_check_mark (const char *fldname, bool value) +{ + if (value) + field_string (fldname, get_check_mark ()); + else + field_skip (fldname); +} + void ui_out::call_do_message (const ui_file_style &style, const char *format, ...) diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 1796e9c9eb3439422a767603d2799f4a7c167cf2..11d12024c2c15dd203a1df9d62eec72039a94c5e 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -206,6 +206,11 @@ class ui_out const char *format, ...) ATTRIBUTE_PRINTF (4, 5); + /* This is used when a table has a "current" field or the like. If + VALUE is true, a check mark of some kind is emitted for the + field. If VALUE is false, the field is skipped instead. */ + void field_check_mark (const char *fldname, bool value); + void spaces (int numspaces) { do_spaces (numspaces); } void text (const char *string) { do_text (string); } void text (const std::string &string) { text (string.c_str ()); } @@ -374,6 +379,14 @@ class ui_out double, double) = 0; virtual void do_progress_end () = 0; + /* Return the appropriate check-mark string. */ + virtual const char *get_check_mark () + { + /* The default is "*" because that's what was done + historically. */ + return "*"; + } + /* Set as not MI-like by default. It is overridden in subclasses if necessary. */ -- 2.49.0