From patchwork Fri Dec 8 16:50:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 81758 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 871C63858C2A for ; Fri, 8 Dec 2023 16:50:41 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 852743858C53 for ; Fri, 8 Dec 2023 16:50:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 852743858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 852743858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702054228; cv=none; b=JgwqQi3rFSFvMqJhfsjo5GOri4IIz+uOZpm/B12xpbyePfOf9nAcnNZHY6ng3UtWR5KThRXpvb01ik+qfatTs9mFwcxf+eS3M5eu4j+VVKuuQnTOacj/XTCzc4wxFDGfTdRYMECaxTeVyVNGhAox1RrdEs1dCBiKZjzYi54lzsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702054228; c=relaxed/simple; bh=NybG19ejQayCodZ6iYOv30m+mqIQU7hsOKn5XHHoW4k=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=xB+81zvteMv7BBrEM8xIKZohdnS8ahXhYFuZZj7ovwg2osO9YuR5J4+9h92Jv/E0XQxMvZ3YnjVItTAaqLJdMKuPsEyYLJEb1xBedrbtorCjTIJDpMmNeJr4JJzRLQkS43glu/J1CDV9I07qmqiShITxqWJdexsacTyeuVAXhMw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 875521F454; Fri, 8 Dec 2023 16:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702054218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=f6zL4INDTESElADzwGFc/wfzay6kjFygc+l/Q6C8/LU=; b=khpuNTdV0Kjs5Uows5dFDyHK1Sfr0lM2q4OXbGztYijeCPWwT6Yc7+AHu87PLwRfSOrrOs TZoC7QULT9LJeas9SyCm9Rb74aoS7q163v6DUfh6XTr9Bfoa406bvPPehrDqWjV12Y/H3s /BnqOVyKzwvReMhl+7GlD40PMc+cipo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702054218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=f6zL4INDTESElADzwGFc/wfzay6kjFygc+l/Q6C8/LU=; b=wd4k40Jj38z0kphVdvNuW/b1YEBrErb/7bXh1UPHDyoHJ/OkKs0R3Xm5QWiY24Q3EF20I5 kV4DA2cp1ojnHGAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702054218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=f6zL4INDTESElADzwGFc/wfzay6kjFygc+l/Q6C8/LU=; b=khpuNTdV0Kjs5Uows5dFDyHK1Sfr0lM2q4OXbGztYijeCPWwT6Yc7+AHu87PLwRfSOrrOs TZoC7QULT9LJeas9SyCm9Rb74aoS7q163v6DUfh6XTr9Bfoa406bvPPehrDqWjV12Y/H3s /BnqOVyKzwvReMhl+7GlD40PMc+cipo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702054218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=f6zL4INDTESElADzwGFc/wfzay6kjFygc+l/Q6C8/LU=; b=wd4k40Jj38z0kphVdvNuW/b1YEBrErb/7bXh1UPHDyoHJ/OkKs0R3Xm5QWiY24Q3EF20I5 kV4DA2cp1ojnHGAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6C94C12FF7; Fri, 8 Dec 2023 16:50:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id AGlAGUpJc2VDEgAAD6G6ig (envelope-from ); Fri, 08 Dec 2023 16:50:18 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Eli Zaretskii Subject: [PATCH v2] [gdb/tui] Show focus window in status line Date: Fri, 8 Dec 2023 17:50:25 +0100 Message-Id: <20231208165025.10973-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Level: * X-Spam-Score: 1.70 Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: 0.70 X-Spamd-Result: default: False [0.70 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 The focused window is highlighted by using active-border-kind instead of border-kind. But if the focused window is the cmd window (which is an unboxed window), then no highlighting is done, and it's not obvious from looking at the screen which window has the focus. Instead, you have to notice the absence of highlighting on boxed windows, and then infer that the focus is on the unboxed window. That approach stops working if there are multiple unboxed windows. Likewise if highlighting is switched off by setting active-border-kind to the same value as border-kind. Make it more explicit which window has the focus by mentioning it in the status window, like so: ... native process 8282 (src) In: main L7 PC: 0x400525 ... Tested on x86_64-linux and ppc64le-linux. Tested-By: Alexandra Petlanova Hajkova Reviewed-By: Eli Zaretskii --- gdb/doc/gdb.texinfo | 3 +++ gdb/testsuite/gdb.tui/single-key.exp | 4 ++-- gdb/tui/tui-data.c | 2 ++ gdb/tui/tui-stack.c | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) base-commit: ee1e9bbb5139d766d70cfa036979cec73a1223b7 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d2428efdb63..de70ee685e6 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -30293,6 +30293,9 @@ Indicates the current @value{GDBN} target. Gives the current process or thread number. When no process is being debugged, this field is set to @code{No process}. +@item focus +Shows the name of the TUI window that has the focus. + @item function Gives the current function name for the selected frame. The name is demangled if demangling is turned on (@pxref{Print Settings}). diff --git a/gdb/testsuite/gdb.tui/single-key.exp b/gdb/testsuite/gdb.tui/single-key.exp index 07c9b00cce5..3925a8142c1 100644 --- a/gdb/testsuite/gdb.tui/single-key.exp +++ b/gdb/testsuite/gdb.tui/single-key.exp @@ -25,12 +25,12 @@ set status_win { 0 15 80 1 } set command_win { 0 16 80 8 } # Check that the status window doesn't show Singlekey. -set re "No process In:" +set re [string_to_regexp "No process (src) In:"] Term::check_region_contents "status window: initial" {*}$status_win $re # Enter single-key mode. Check that the status window does show Singlekey. send_gdb "\030s" -set re "No process \\(SingleKey\\) In:" +set re [string_to_regexp "No process (SingleKey) (src) In:"] gdb_assert { [Term::wait_for_region_contents {*}$status_win $re] } \ "status window: single-key mode" diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index c51bd118165..f5a98233ea0 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -26,6 +26,7 @@ #include "tui/tui-win.h" #include "tui/tui-wingeneral.h" #include "tui/tui-winsource.h" +#include "tui/tui-stack.h" #include "gdb_curses.h" #include @@ -69,6 +70,7 @@ tui_set_win_focus_to (struct tui_win_info *win_info) tui_unhighlight_win (win_with_focus); win_with_focus = win_info; tui_highlight_win (win_info); + tui_show_locator_content (); } } diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 723d6268aad..8bf65ea3556 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -106,6 +106,12 @@ tui_locator_window::make_status_line () const const char *pc_buf = pc_out.c_str (); int pc_width = pc_out.size (); + /* Width of the field showing the window with current focus. For a window + named "src" we show "(src)". */ + int focus_width = (tui_win_with_focus () != nullptr + ? 1 + strlen (tui_win_with_focus ()->name ()) + 1 + : 0); + /* First determine the amount of proc name width we have available. The +1 are for a space separator between fields. */ proc_width = (status_size @@ -116,6 +122,9 @@ tui_locator_window::make_status_line () const - (PC_PREFIX.size () + pc_width + 1) - (tui_current_key_mode == TUI_SINGLE_KEY_MODE ? (SINGLE_KEY.size () + 1) + : 0) + - (focus_width > 0 + ? focus_width + 1 : 0)); /* If there is no room to print the function name, try by removing @@ -159,6 +168,13 @@ tui_locator_window::make_status_line () const string.puts (" "); } + if (tui_win_with_focus () != nullptr) + { + string.puts ("("); + string.puts (tui_win_with_focus ()->name ()); + string.puts (") "); + } + /* Procedure/class name. */ if (proc_width > 0) {