public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/tui] Show regs when switching to regs layout
@ 2023-11-24 10:27 Tom de Vries
  2023-11-26  7:55 ` Tom de Vries
  2023-11-27 12:16 ` Alexandra Petlanova Hajkova
  0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2023-11-24 10:27 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/tui] Show regs when switching to regs layout
  2023-11-24 10:27 [PATCH] [gdb/tui] Show regs when switching to regs layout Tom de Vries
@ 2023-11-26  7:55 ` Tom de Vries
  2023-11-27 12:16 ` Alexandra Petlanova Hajkova
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2023-11-26  7:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

On 11/24/23 11:27, Tom de Vries wrote:
> 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.
> 

I've submitted a v2 ( 
https://sourceware.org/pipermail/gdb-patches/2023-November/204507.html ) 
that handles this in rerender instead.

Thanks,
- Tom

> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/tui] Show regs when switching to regs layout
  2023-11-24 10:27 [PATCH] [gdb/tui] Show regs when switching to regs layout Tom de Vries
  2023-11-26  7:55 ` Tom de Vries
@ 2023-11-27 12:16 ` Alexandra Petlanova Hajkova
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandra Petlanova Hajkova @ 2023-11-27 12:16 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

On Fri, Nov 24, 2023 at 11:27 AM Tom de Vries <tdevries@suse.de> wrote:

> 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
> ---
> I can confirm I can see this issue on ppc64le Fedora Rawhide and this
> patch fixes this. I'm able to see the Register group now
>
when running  "gdb/gdb -q /bin/ls -ex start -ex "layout regs"". I can also
confirm this change does not introduce any regressions.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-27 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-24 10:27 [PATCH] [gdb/tui] Show regs when switching to regs layout Tom de Vries
2023-11-26  7:55 ` Tom de Vries
2023-11-27 12:16 ` Alexandra Petlanova Hajkova

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).