From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/tui] Show regs when switching to regs layout
Date: Fri, 24 Nov 2023 11:27:10 +0100 [thread overview]
Message-ID: <20231124102710.7681-1-tdevries@suse.de> (raw)
When starting gdb in CLI mode, running to main and switching into the TUI regs
layout:
...
$ gdb -q a.out -ex start -ex "layout regs"
...
we get:
...
+---------------------------------+
| |
| [ Register Values Unavailable ] |
| |
+---------------------------------+
...
Fix this by updating the TUI_DATA_WIN in tui_apply_current_layout.
Tested on x86_64-linux.
PR tui/28600
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28600
---
gdb/testsuite/gdb.tui/regs.exp | 10 ++++++----
gdb/tui/tui-layout.c | 6 ++++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.tui/regs.exp b/gdb/testsuite/gdb.tui/regs.exp
index 520f6ddba96..0be99625b9f 100644
--- a/gdb/testsuite/gdb.tui/regs.exp
+++ b/gdb/testsuite/gdb.tui/regs.exp
@@ -41,10 +41,12 @@ Term::command "layout regs"
Term::check_box "register box" 0 0 80 8
Term::check_box "source box in regs layout" 0 7 80 8
-set text [Term::get_line 1]
-# Just check for any register window content at all.
-Term::check_contents "any register contents" "\\|.*\[^ \].*\\|"
-
+# The current frame is main, check that registers are available.
+set re_reg_vals_unavailable \
+ [string_to_regexp {[ Register Values Unavailable ]}]
+gdb_assert \
+ { ![Term::check_region_contents_p 0 0 80 8 $re_reg_vals_unavailable] } \
+ "Register values available"
# Check that we can successfully cause the register window to appear
# using the 'tui reg next' and 'tui reg prev' commands.
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 85f4991c769..813f8f93b57 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -112,6 +112,12 @@ tui_apply_current_layout (bool preserve_cmd_win_size_p)
if (gdbarch == nullptr && TUI_DISASM_WIN != nullptr)
tui_get_begin_asm_address (&gdbarch, &addr);
tui_update_source_windows_with_addr (gdbarch, addr);
+
+ if (TUI_DATA_WIN != nullptr && has_stack_frames ())
+ {
+ frame_info_ptr fi = get_selected_frame (NULL);
+ TUI_DATA_WIN->check_register_values (fi);
+ }
}
/* See tui-layout. */
base-commit: 2ec31e54dff83130fbde8d2f674469078ee203d5
--
2.35.3
next reply other threads:[~2023-11-24 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 10:27 Tom de Vries [this message]
2023-11-26 7:55 ` Tom de Vries
2023-11-27 12:16 ` Alexandra Petlanova Hajkova
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=20231124102710.7681-1-tdevries@suse.de \
--to=tdevries@suse.de \
--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).