diff options
author | Tom de Vries <tdevries@suse.de> | 2023-12-16 09:31:29 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-12-16 09:31:29 +0100 |
commit | 86a6f9a9fb112614c15cc17630b29fbc62d3bca5 (patch) | |
tree | 49bacf6cc5769d282d3240711ec9b4259ca58dd1 /gdb | |
parent | bebb0dd44b98f5b6555cb75389b7b14deed9550e (diff) | |
download | gdb-86a6f9a9fb112614c15cc17630b29fbc62d3bca5.zip gdb-86a6f9a9fb112614c15cc17630b29fbc62d3bca5.tar.gz gdb-86a6f9a9fb112614c15cc17630b29fbc62d3bca5.tar.bz2 |
[gdb/tui] Show regs when switching to regs layout
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 handling this case in tui_data_window::rerender.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR tui/28600
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28600
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.tui/regs.exp | 10 | ||||
-rw-r--r-- | gdb/tui/tui-regs.c | 14 | ||||
-rw-r--r-- | gdb/tui/tui-regs.h | 6 |
3 files changed, 22 insertions, 8 deletions
diff --git a/gdb/testsuite/gdb.tui/regs.exp b/gdb/testsuite/gdb.tui/regs.exp index 520f6dd..0be9962 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-regs.c b/gdb/tui/tui-regs.c index ba801dd..4ed3a2e 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -192,7 +192,7 @@ tui_data_window::show_registers (const reggroup *group) m_regs_content.clear (); } - rerender (); + rerender (false); } @@ -415,10 +415,18 @@ tui_data_window::erase_data_content (const char *prompt) /* See tui-regs.h. */ void -tui_data_window::rerender () +tui_data_window::rerender (bool toplevel) { if (m_regs_content.empty ()) - erase_data_content (_("[ Register Values Unavailable ]")); + { + if (toplevel && has_stack_frames ()) + { + frame_info_ptr fi = get_selected_frame (NULL); + check_register_values (fi); + } + else + erase_data_content (_("[ Register Values Unavailable ]")); + } else { erase_data_content (NULL); diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index 5adff63..1abd22c 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -75,7 +75,11 @@ protected: { } - void rerender () override; + void rerender (bool toplevel); + void rerender () override + { + rerender (true); + } private: |