[PATCH] [gdb/tui] Show regs when switching to regs layout
Tom de Vries
tdevries@suse.de
Fri Nov 24 10:27:10 GMT 2023
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
More information about the Gdb-patches
mailing list