From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IL95ARIS9GGyBAAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 10:56:02 -0500 Received: by simark.ca (Postfix, from userid 112) id 01C021F3B7; Fri, 28 Jan 2022 10:56:01 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0EA011EE18 for ; Fri, 28 Jan 2022 10:56:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D301384602E for ; Fri, 28 Jan 2022 15:56:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D301384602E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643385360; bh=nlUdj38cggLKt9kxEhBSn0ufIRz5HejJ01S0ZywU/Gs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oQS3B7LWNOEN0n8VnTPfurGTusdCRsiHFxOrvOQx2Be2TmG7dcmCtZbuy1FIwT5Zi k25LFCNhr9eNJRLN3CeoNlbAgHyWhGlHmP/KvAgEUWF8ZrNyZCtIrVB9uyEwjy4VpQ 72PmeFXJtlCr5MP5vKmc90IATycoYHoKs8IvyPdA= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D3405385F026 for ; Fri, 28 Jan 2022 15:55:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3405385F026 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-iVzGY4zbP6GZYBL6NlgcRg-1; Fri, 28 Jan 2022 10:55:15 -0500 X-MC-Unique: iVzGY4zbP6GZYBL6NlgcRg-1 Received: by mail-wr1-f71.google.com with SMTP id h12-20020adfa4cc000000b001d474912698so2390430wrb.2 for ; Fri, 28 Jan 2022 07:55:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nlUdj38cggLKt9kxEhBSn0ufIRz5HejJ01S0ZywU/Gs=; b=fNcj34pG8AFVo+4ce0r3xVUnXoiR3xN0ML0FhsfaDQaJ4QZTRB1Cd3Khkm/je5Ai1q b85xlR/vMnZ/PAfeqgIfXYq5Qys//+QwiULAGnPGfAY/J+t8d0sTKGvGK8BMxnVmZ7J8 XBL9JKGuWCoosBM5SjU5YBG7uBqyE6Wok8+KrDwK83lvHje41MFreGLgmvFEwm979du7 D4NAZvNU/BIWZqnzHD27dQsI6EX0Fe4sijXnUjGMe5WTi34oL0pHHsr0o73KnFJPPEZk 5GX1HXlsWxxFoYgmBIFR1Q9fAWKob+5Gr71Gre9hGZKPM/FettddEOql8BWC7e0ntU/5 z5Kw== X-Gm-Message-State: AOAM5304eHlTOkwChN+Jpd8J0yq5SCuzAOwqwjQ4Pj8mEK5rcY95Af6y u86SOw2RqlEiC9TZhypo1m0lFD8UeDn4CRjMGq73zvOq1GFGeOxygQ8hNYxn+LVkwdJA4Hyo/ql L8Y75D3w64J3+XzDIePB6Vfi2VPSNo38QdMGsyS6x3L4TOoQAKCcyacUrcu5b44AOgW1H3trnYg == X-Received: by 2002:a05:6000:178d:: with SMTP id e13mr7440803wrg.211.1643385314167; Fri, 28 Jan 2022 07:55:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKQgyOI7Bev3kGxZj0IJfYFUCqW9t+88doRX5hdodmrvywufLag3+mK4N5Y2gW365vB5aYpw== X-Received: by 2002:a05:6000:178d:: with SMTP id e13mr7440788wrg.211.1643385313908; Fri, 28 Jan 2022 07:55:13 -0800 (PST) Received: from localhost (host86-140-92-93.range86-140.btcentralplus.com. [86.140.92.93]) by smtp.gmail.com with ESMTPSA id q13sm5037940wrd.78.2022.01.28.07.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 07:55:13 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH 1/7] gdb/tui: add window width information to 'info win' output Date: Fri, 28 Jan 2022 15:55:02 +0000 Message-Id: <8a07632c8949a934306406f22a5c659018cd1d39.1643385021.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Now that we support horizontal window placement in the tui, it makes sense to have 'info win' include the width, as well as the height, of the currently visible windows. That's what this commit does. Example output is now: (gdb) info win Name Lines Columns Focus src 12 40 (has focus) asm 12 41 status 1 80 cmd 11 80 I've added a NEWS entry, but the documentation was already suitably vague, it just says that 'info win' displays the size of the visible windows, so I don't think anything needs to be added there. I've also added some tests, as far as I could find, the 'info win' command was previously untested. --- gdb/NEWS | 4 ++ gdb/testsuite/gdb.tui/info-win.exp | 61 ++++++++++++++++++++++++++++++ gdb/tui/tui-win.c | 4 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.tui/info-win.exp diff --git a/gdb/NEWS b/gdb/NEWS index e1900596ca7..8da68c88def 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -102,6 +102,10 @@ show debug lin-lwp debug linux-nat' and 'show debug linux-nat' should be used instead. +info win + This command now includes information about the width of the tui + windows in its output. + * Python API ** New function gdb.add_history(), which takes a gdb.Value object diff --git a/gdb/testsuite/gdb.tui/info-win.exp b/gdb/testsuite/gdb.tui/info-win.exp new file mode 100644 index 00000000000..2607d5be493 --- /dev/null +++ b/gdb/testsuite/gdb.tui/info-win.exp @@ -0,0 +1,61 @@ +# Copyright 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test 'info win'. + +tuiterm_env + +standard_testfile + +Term::clean_restart 24 80 + +if {![Term::enter_tui]} { + unsupported "TUI not supported" + return +} + +Term::command "layout src" +Term::command "info win" +Term::check_region_contents "info win, layout src" \ + 0 16 80 8 [multi_line "info win\\s+" \ + "Name\\s+Lines\\s+Columns\\s+Focus\\s+" \ + "src\\s+15\\s+80\\s+\\(has focus\\)\\s+" \ + "status\\s+1\\s+80\\s+" \ + "cmd\\s+8\\s+80\\s+"] + +Term::command "tui new-layout h { -horizontal src 1 asm 1 } 1 status 0 cmd 1" +Term::command "layout h" +Term::command "winheight cmd + 3" + +# As the tuiterm.exp library just waits for the prompt and command to +# be echo'ed bcak to the screen, multiple 'info win' calls like this +# have a problem. Dejagnu will send the command to gdb, but will then +# immediately see the '(gdb) info win' output from the first use +# above. This means we end up rushing ahead, and some tests might +# fail. +# +# To work around this, I'm sending a unique command 'p 1' here, that +# only happens after the second 'info win' call. When the 'p 1' +# completes, I know the second 'info win' has also completed. +Term::command "info win" +Term::command "p 1" + +Term::check_region_contents "info win, layout h" \ + 0 13 80 11 [multi_line "info win\\s+" \ + "Name\\s+Lines\\s+Columns\\s+Focus\\s+" \ + "src\\s+12\\s+40\\s+\\(has focus\\)\\s+" \ + "asm\\s+12\\s+41\\s+" \ + "status\\s+1\\s+80\\s+" \ + "cmd\\s+11\\s+80\\s+"] diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index c85dfd4e882..fd6ca59a728 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -714,9 +714,10 @@ tui_all_windows_info (const char *arg, int from_tty) struct tui_win_info *win_with_focus = tui_win_with_focus (); struct ui_out *uiout = current_uiout; - ui_out_emit_table table_emitter (uiout, 3, -1, "tui-windows"); + ui_out_emit_table table_emitter (uiout, 4, -1, "tui-windows"); uiout->table_header (10, ui_left, "name", "Name"); uiout->table_header (5, ui_right, "lines", "Lines"); + uiout->table_header (7, ui_right, "columns", "Columns"); uiout->table_header (10, ui_left, "focus", "Focus"); uiout->table_body (); @@ -727,6 +728,7 @@ tui_all_windows_info (const char *arg, int from_tty) uiout->field_string ("name", win_info->name ()); uiout->field_signed ("lines", win_info->height); + uiout->field_signed ("columns", win_info->width); if (win_with_focus == win_info) uiout->field_string ("focus", _("(has focus)")); else -- 2.25.4