public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: gdb-patches@sourceware.org
Cc: "Arsen Arsenović" <arsen@aarsen.me>
Subject: [PATCH] gdb/tui: add a vsplit layout
Date: Fri,  3 Nov 2023 21:34:26 +0100	[thread overview]
Message-ID: <20231104014343.3199584-1-arsen@aarsen.me> (raw)

The usual 'split' layout features a vertical stack that inadequately
makes use of widely-used widescreen displays.  This layout displays the
same information but in a horizontal stack in a way that's quite handy
for debugging on wide screens.
---
Evening!

For a long time now, I've been using the layout added by this patch for
debugging on my widescreen monitor, and it has been working well, and
I've shared this layout with other folks before.

In particular, at some point in the past I shared it with Bruno Haible,
who got quite accustomed to it, and was surprised to find that it's
missing on a new box he did not have his gdbinit on.  He suggested that
I should propose this layout for inclusion in GDB proper.

This seems sound to me, since vsplit is a natural counterpart to the
usual split layout already shipped with GDB.

This patch adds the vsplit layout and a corresponding test.

Tested on x86_64-pc-linux-gnu.

Have a lovely night!

 gdb/doc/gdb.texinfo                  |  4 ++++
 gdb/testsuite/gdb.tui/tui-layout.exp |  5 ++++-
 gdb/tui/tui-layout.c                 | 11 +++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index db1a82ec838..209af3a4b0e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -30604,6 +30604,10 @@ Display the assembly and command windows.
 @item split
 Display the source, assembly, and command windows.
 
+@item vsplit
+Display the source and assembly side by side, and the command window
+below them.
+
 @item regs
 When in @code{src} layout display the register, source, and command
 windows.  When in @code{asm} or @code{split} layout display the
diff --git a/gdb/testsuite/gdb.tui/tui-layout.exp b/gdb/testsuite/gdb.tui/tui-layout.exp
index 90f27c5eac1..ea99d8f6ef9 100644
--- a/gdb/testsuite/gdb.tui/tui-layout.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout.exp
@@ -83,13 +83,16 @@ proc test_layout_or_focus {layout_name terminal execution} {
 	} elseif {$layout_name == "split"} {
 	    Term::check_box "src box" 0 0 80 8
 	    Term::check_box "asm box" 0 7 80 8
+	} elseif {$layout_name == "vsplit"} {
+	    Term::check_box "src box" 0 0 40 15
+	    Term::check_box "asm box" 39 0 41 15
 	}
     }
 }
 
 foreach_with_prefix terminal {ansi dumb} {
     foreach_with_prefix execution {false true} {
-	foreach_with_prefix layout {"asm" "reg" "src" "split"} {
+	foreach_with_prefix layout {"asm" "reg" "src" "split" "vsplit"} {
 	    test_layout_or_focus $layout $terminal $execution
 	}
     }
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 159445dc520..824ed282622 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -1184,6 +1184,17 @@ initialize_layouts ()
   layout->add_window (CMD_NAME, 1);
   add_layout_command ("split", layout);
 
+  layout = new tui_layout_split ();
+  {
+    auto vsplit_top_half  = std::make_unique<tui_layout_split> (false);
+    vsplit_top_half->add_window (SRC_NAME, 1);
+    vsplit_top_half->add_window (DISASSEM_NAME, 1);
+    layout->add_split (std::move (vsplit_top_half), 1);
+    layout->add_window (STATUS_NAME, 0);
+    layout->add_window (CMD_NAME, 1);
+    add_layout_command ("vsplit", layout);
+  }
+
   layout = new tui_layout_split ();
   layout->add_window (DATA_NAME, 1);
   layout->add_window (SRC_NAME, 1);
-- 
2.42.0


             reply	other threads:[~2023-11-04  1:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 20:34 Arsen Arsenović [this message]
2023-11-04 10:39 ` Arsen Arsenović

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231104014343.3199584-1-arsen@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).