[v2,10/14] Remove tui_refreshing_registers

Message ID 20240120-tui-regs-cleanup-v2-10-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
  The comment by tui_refreshing_registers mentions a hook that no longer
exists.  However, maybe the comment is wrong.

The code paths touching tui_refreshing_registers can only be called in two places:

1. From the before_prompt observer.  This is only called when a prompt
   is about to be displayed.

2. From the register_changed observer.  This is only called when
   value_assign changes a register value.

From this it seems clear that the recursion case here cannot in fact
occur.  This patch removes the variable.

Tested-By: Tom de Vries <tdevries@suse.de>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
---
 gdb/tui/tui-hooks.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
  

Patch

diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index bd8f99b786b..3a4eda91aa3 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -63,9 +63,6 @@  static void
 tui_all_objfiles_removed (program_space *pspace)
 { tui_on_objfiles_changed (); }
 
-/* Prevent recursion of deprecated_register_changed_hook().  */
-static bool tui_refreshing_registers = false;
-
 /* Observer for the register_changed notification.  */
 
 static void
@@ -82,12 +79,7 @@  tui_register_changed (frame_info_ptr frame, int regno)
      up in the other.  So we always use the selected frame here, and ignore
      FRAME.  */
   fi = get_selected_frame (NULL);
-  if (!tui_refreshing_registers)
-    {
-      tui_refreshing_registers = true;
-      TUI_DATA_WIN->check_register_values (fi);
-      tui_refreshing_registers = false;
-    }
+  TUI_DATA_WIN->check_register_values (fi);
 }
 
 /* Breakpoint creation hook.
@@ -145,11 +137,7 @@  tui_refresh_frame_and_register_information ()
       /* Refresh the register window if it's visible.  */
       if (tui_is_window_visible (DATA_WIN)
 	  && (frame_info_changed_p || from_stack))
-	{
-	  tui_refreshing_registers = true;
-	  TUI_DATA_WIN->check_register_values (fi);
-	  tui_refreshing_registers = false;
-	}
+	TUI_DATA_WIN->check_register_values (fi);
     }
   else if (!from_stack)
     {