public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 07/14] Simplify update_register_data
Date: Mon, 18 Dec 2023 19:48:02 +0000	[thread overview]
Message-ID: <87zfy7z40d.fsf@redhat.com> (raw)
In-Reply-To: <20231217-tui-regs-cleanup-v1-7-67bd0ea1e8be@tromey.com>

Tom Tromey <tom@tromey.com> writes:

> This changes update_register_data to always update the register data.
> The idea here is that this is really only called when either the
> desired register group changes, or when gdb transitions from not
> having a frame to having a frame.
>
> show_registers is also simplified slightly to account for this.
> ---
>  gdb/tui/tui-regs.c | 57 ++++++++++++++++++++----------------------------------
>  1 file changed, 21 insertions(+), 36 deletions(-)
>
> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
> index 0ad23e93778..7b6b669fe51 100644
> --- a/gdb/tui/tui-regs.c
> +++ b/gdb/tui/tui-regs.c
> @@ -170,15 +170,10 @@ tui_data_window::show_registers (const reggroup *group)
>      group = general_reggroup;
>  
>    if (target_has_registers () && target_has_stack () && target_has_memory ())
> -    {
> -      update_register_data (group, get_selected_frame (NULL));
> -
> -      /* Clear all notation of changed values.  */
> -      for (auto &&data_item_win : m_regs_content)
> -	data_item_win.highlight = false;
> -    }
> +    update_register_data (group, get_selected_frame (nullptr));
>    else
>      {
> +      set_title (_("Registers"));

It's strange that you add this line, but in the very next commit change
the text to the empty string.  Maybe I'm missing something, but it feels
like you could just set the empty string here maybe?

Thanks,
Andrew


>        m_current_group = nullptr;
>        m_regs_content.clear ();
>      }
> @@ -195,40 +190,30 @@ void
>  tui_data_window::update_register_data (const reggroup *group,
>  				       frame_info_ptr frame)
>  {
> -  if (group != m_current_group)
> -    {
> -      m_current_group = group;
> +  m_current_group = group;
>  
> -      /* Make a new title showing which group we display.  */
> -      this->set_title (string_printf ("Register group: %s", group->name ()));
> +  /* Make a new title showing which group we display.  */
> +  this->set_title (string_printf ("Register group: %s", group->name ()));
>  
> -      /* Create the registers.  */
> -      m_regs_content.clear ();
> +  /* Create the registers.  */
> +  m_regs_content.clear ();
>  
> -      struct gdbarch *gdbarch = get_frame_arch (frame);
> -      for (int regnum = 0;
> -	   regnum < gdbarch_num_cooked_regs (gdbarch);
> -	   regnum++)
> -	{
> -	  /* Must be in the group.  */
> -	  if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
> -	    continue;
> +  struct gdbarch *gdbarch = get_frame_arch (frame);
> +  for (int regnum = 0;
> +       regnum < gdbarch_num_cooked_regs (gdbarch);
> +       regnum++)
> +    {
> +      /* Must be in the group.  */
> +      if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
> +	continue;
>  
> -	  /* If the register name is empty, it is undefined for this
> -	     processor, so don't display anything.  */
> -	  const char *name = gdbarch_register_name (gdbarch, regnum);
> -	  if (*name == '\0')
> -	    continue;
> +      /* If the register name is empty, it is undefined for this
> +	 processor, so don't display anything.  */
> +      const char *name = gdbarch_register_name (gdbarch, regnum);
> +      if (*name == '\0')
> +	continue;
>  
> -	  m_regs_content.emplace_back (regnum, frame);
> -	}
> -    }
> -  else
> -    {
> -      /* The group did not change, so we can simply update each
> -	 item. */
> -      for (tui_register_info &reg : m_regs_content)
> -	reg.update (frame);
> +      m_regs_content.emplace_back (regnum, frame);
>      }
>  }
>  
>
> -- 
> 2.43.0


  reply	other threads:[~2023-12-18 19:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-17 19:50 [PATCH 00/14] Cleanups for the TUi register window Tom Tromey
2023-12-17 19:50 ` [PATCH 01/14] Use pop_back in tui_register_format Tom Tromey
2023-12-17 19:50 ` [PATCH 02/14] Minor C++ cleanups in tui-regs.c Tom Tromey
2023-12-17 19:50 ` [PATCH 03/14] Simplify tui_data_window::show_register_group Tom Tromey
2023-12-18 15:42   ` Andrew Burgess
2024-01-20 17:11     ` Tom Tromey
2023-12-17 19:50 ` [PATCH 04/14] Rename tui_data_item_window -> tui_register_info Tom Tromey
2023-12-17 19:50 ` [PATCH 05/14] Remove tui_register_info::visible Tom Tromey
2023-12-18 17:29   ` Hannes Domani
2024-01-20 17:02     ` Tom Tromey
2023-12-18 19:00   ` Andrew Burgess
2024-01-20 17:05     ` Tom Tromey
2023-12-17 19:50 ` [PATCH 06/14] Move scrollok call in register window Tom Tromey
2023-12-18 19:28   ` Andrew Burgess
2023-12-18 23:33     ` Tom Tromey
2023-12-17 19:50 ` [PATCH 07/14] Simplify update_register_data Tom Tromey
2023-12-18 19:48   ` Andrew Burgess [this message]
2024-01-20 17:06     ` Tom Tromey
2023-12-17 19:50 ` [PATCH 08/14] Remove the TUI register window rerender overload Tom Tromey
2023-12-18 19:54   ` Andrew Burgess
2024-01-20 17:17     ` Tom Tromey
2023-12-17 19:50 ` [PATCH 09/14] Simplify tui_data_win::erase_data_content Tom Tromey
2023-12-17 19:50 ` [PATCH 10/14] Remove tui_refreshing_registers Tom Tromey
2023-12-17 19:50 ` [PATCH 11/14] Remove redundant check from tui_refresh_frame_and_register_information Tom Tromey
2023-12-18 17:32   ` Hannes Domani
2023-12-18 23:35     ` Tom Tromey
2023-12-19 10:26       ` Andrew Burgess
2024-01-20 18:21         ` Tom Tromey
2023-12-17 19:50 ` [PATCH 12/14] Return void from tui_show_frame_info Tom Tromey
2023-12-17 19:50 ` [PATCH 13/14] Rename show_registers -> set_register_group Tom Tromey
2023-12-17 19:50 ` [PATCH 14/14] Update TUI register window when the inferior exits Tom Tromey
2023-12-18 14:07 ` [PATCH 00/14] Cleanups for the TUi register window Tom de Vries
2023-12-19 10:31 ` Andrew Burgess

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=87zfy7z40d.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).