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 05/14] Remove tui_register_info::visible
Date: Mon, 18 Dec 2023 19:00:21 +0000	[thread overview]
Message-ID: <87edfj49q2.fsf@redhat.com> (raw)
In-Reply-To: <20231217-tui-regs-cleanup-v1-5-67bd0ea1e8be@tromey.com>

Tom Tromey <tom@tromey.com> writes:

> tui_register_info::visible is redundant with the fact that y==0 means
> that the register is not visible -- and some spots already check the
> latter.

I'm not sure moving to 'y > 0' is an improvement though...

Would a better solution be to change the visible to a member function,
defined in the header file (so it can inline)?

Thanks,
Andrew


>          This patch removes this member in favor of having a single
> indication of the register's visibility.  This change makes it clear
> that delete_data_content_windows is not needed, so this is removed as
> well.
> ---
>  gdb/tui/tui-regs.c | 15 +--------------
>  gdb/tui/tui-regs.h |  1 -
>  2 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
> index f87d1ff8721..9108e460d6f 100644
> --- a/gdb/tui/tui-regs.c
> +++ b/gdb/tui/tui-regs.c
> @@ -269,7 +269,6 @@ tui_data_window::display_registers_from (int start_element_no)
>  	  /* Create the window if necessary.  */
>  	  m_regs_content[i].x = box_width () + (m_item_width * j);
>  	  m_regs_content[i].y = cur_y;
> -	  m_regs_content[i].visible = true;
>  	  m_regs_content[i].rerender (handle.get (), m_item_width);
>  	  i++;		/* Next register.  */
>  	}
> @@ -347,23 +346,13 @@ tui_data_window::first_data_item_displayed ()
>  {
>    for (int i = 0; i < m_regs_content.size (); i++)
>      {
> -      if (m_regs_content[i].visible)
> +      if (m_regs_content[i].y > 0)
>  	return i;
>      }
>  
>    return -1;
>  }
>  
> -/* See tui-regs.h.  */
> -
> -void
> -tui_data_window::delete_data_content_windows ()
> -{
> -  for (auto &win : m_regs_content)
> -    win.visible = false;
> -}
> -
> -
>  void
>  tui_data_window::erase_data_content (const char *prompt)
>  {
> @@ -401,7 +390,6 @@ tui_data_window::rerender (bool toplevel)
>    else
>      {
>        erase_data_content (NULL);
> -      delete_data_content_windows ();
>        display_registers_from (0);
>      }
>  }
> @@ -426,7 +414,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
>      {
>        first_line += num_to_scroll;
>        erase_data_content (NULL);
> -      delete_data_content_windows ();
>        display_registers_from_line (first_line);
>      }
>  }
> diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
> index 1a9f30fa270..701b8707947 100644
> --- a/gdb/tui/tui-regs.h
> +++ b/gdb/tui/tui-regs.h
> @@ -50,7 +50,6 @@ struct tui_register_info
>    /* The register number.  */
>    int regno;
>    bool highlight = false;
> -  bool visible = false;
>    std::string content;
>  };
>  
>
> -- 
> 2.43.0


  parent reply	other threads:[~2023-12-18 19:00 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 [this message]
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
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=87edfj49q2.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).