[v2,04/14] Rename tui_data_item_window -> tui_register_info

Message ID 20240120-tui-regs-cleanup-v2-4-a3cccc6a3573@tromey.com
State New
Headers
Series Cleanups for the TUi register window |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Tom Tromey Jan. 20, 2024, 6:23 p.m. UTC
  tui_data_item_window used to hold a curses window, but we removed that
ages ago.  Now it just holds information about a single register.
This patch renames the class to make it more clearly reflect its
meaning.

Tested-By: Tom de Vries <tdevries@suse.de>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
---
 gdb/tui/tui-regs.c | 13 +++++--------
 gdb/tui/tui-regs.h | 14 +++++++-------
 2 files changed, 12 insertions(+), 15 deletions(-)
  

Patch

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index f7911b53bfb..bacb23ab298 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -105,15 +105,12 @@  tui_register_format (frame_info_ptr frame, int regnum)
    the display.  update 'content' and set 'highlight' if the contents
    changed.  */
 void
-tui_data_item_window::update (const frame_info_ptr &frame)
+tui_register_info::update (const frame_info_ptr &frame)
 {
   if (target_has_registers ())
     {
       std::string new_content = tui_register_format (frame, m_regno);
-
-      if (content != new_content)
-	highlight = true;
-
+      highlight = content != new_content;
       content = std::move (new_content);
     }
 }
@@ -229,7 +226,7 @@  tui_data_window::update_register_data (const reggroup *group,
     {
       /* The group did not change, so we can simply update each
 	 item. */
-      for (tui_data_item_window &reg : m_regs_content)
+      for (tui_register_info &reg : m_regs_content)
 	reg.update (frame);
     }
 }
@@ -443,7 +440,7 @@  tui_data_window::check_register_values (frame_info_ptr frame)
     show_registers (m_current_group);
   else
     {
-      for (tui_data_item_window &data_item_win : m_regs_content)
+      for (tui_register_info &data_item_win : m_regs_content)
 	{
 	  bool was_hilighted = data_item_win.highlight;
 
@@ -462,7 +459,7 @@  tui_data_window::check_register_values (frame_info_ptr frame)
 /* Display a register in a window.  If hilite is TRUE, then the value
    will be displayed in reverse video.  */
 void
-tui_data_item_window::rerender (WINDOW *handle, int field_width)
+tui_register_info::rerender (WINDOW *handle, int field_width)
 {
   /* In case the regs window is not boxed, we'll write the last char in the
      last line here, causing a scroll, so prevent that.  */
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index c1f89a5c1a6..e7125e457f5 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -25,20 +25,20 @@ 
 #include "tui/tui-data.h"
 #include "reggroups.h"
 
-/* A data item window.  */
+/* Information about the display of a single register.  */
 
-struct tui_data_item_window
+struct tui_register_info
 {
-  tui_data_item_window (int regno, const frame_info_ptr &frame)
+  tui_register_info (int regno, const frame_info_ptr &frame)
     : m_regno (regno)
   {
     update (frame);
     highlight = false;
   }
 
-  DISABLE_COPY_AND_ASSIGN (tui_data_item_window);
+  DISABLE_COPY_AND_ASSIGN (tui_register_info);
 
-  tui_data_item_window (tui_data_item_window &&) = default;
+  tui_register_info (tui_register_info &&) = default;
 
   void update (const frame_info_ptr &frame);
 
@@ -136,8 +136,8 @@  struct tui_data_window : public tui_win_info
 
   void erase_data_content (const char *prompt);
 
-  /* Windows that are used to display registers.  */
-  std::vector<tui_data_item_window> m_regs_content;
+  /* Information about each register in the current register group.  */
+  std::vector<tui_register_info> m_regs_content;
   int m_regs_column_count = 0;
   const reggroup *m_current_group = nullptr;