[04/14] Rename tui_data_item_window -> tui_register_info

Message ID 20231217-tui-regs-cleanup-v1-4-67bd0ea1e8be@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-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey Dec. 17, 2023, 7:50 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.
---
 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 7b8bf323f50..f87d1ff8721 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)
    display.  When changedp is set, check if the new register value has
    changed with respect to the previous call.  */
 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, regno);
-
-      if (content != new_content)
-	highlight = true;
-
+      highlight = content != new_content;
       content = std::move (new_content);
     }
 }
@@ -230,7 +227,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);
     }
 }
@@ -444,7 +441,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;
 
@@ -463,7 +460,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 9c451ba5996..1a9f30fa270 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)
     : 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);
 
@@ -133,8 +133,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;