This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Replace deprecated_detach_hook by an observer in TUI


Hi!

The TUI is using several deprecated hooks.
I've replaced deprecated_detach_hook by an inferior exit observer.
It seems that after this patch is applied, the detach hook is no longer used.
The patch does not remove it, let me know if you want me to do it.

When the inferior exits, the TUI must leave the SingleKey mode so
that gdb's prompt is displayed (remaining in this mode while there is
no inferior is confusing).

I've committed the attached patch.

Stephane

2012-11-08  Stephane Carrez  <Stephane.Carrez@gmail.com>

	* tui/tui-hooks.c (tui_inferior_exit): New function.
	(tui_detach_hook): Remove.
	(tui_install_hooks): Install the inferior exit observer.
	(tui_remove_hooks): Remove it.

Index: gdb/tui/tui-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-hooks.c,v
retrieving revision 1.48
diff -u -p -r1.48 tui-hooks.c
--- gdb/tui/tui-hooks.c 24 May 2012 15:54:57 -0000      1.48
+++ gdb/tui/tui-hooks.c 7 Nov 2012 22:42:21 -0000
@@ -245,11 +245,14 @@ tui_print_frame_info_listing_hook (struc
   tui_show_frame_info (get_selected_frame (NULL));
 }

-/* Called when the target process died or is detached.
-   Update the status line.  */
+/* Perform all necessary cleanups regarding our module's inferior data
+   that is required after the inferior INF just exited.  */
+
 static void
-tui_detach_hook (void)
+tui_inferior_exit (struct inferior *inf)
 {
+  /* Leave the SingleKey mode to make sure the gdb prompt is visible.  */
+  tui_set_key_mode (TUI_COMMAND_MODE);
   tui_show_frame_info (0);
   tui_display_main ();
 }
@@ -258,6 +261,7 @@ tui_detach_hook (void)
 static struct observer *tui_bp_created_observer;
 static struct observer *tui_bp_deleted_observer;
 static struct observer *tui_bp_modified_observer;
+static struct observer *tui_inferior_exit_observer;

 /* Install the TUI specific hooks.  */
 void
@@ -278,9 +282,10 @@ tui_install_hooks (void)
     = observer_attach_breakpoint_deleted (tui_event_delete_breakpoint);
   tui_bp_modified_observer
     = observer_attach_breakpoint_modified (tui_event_modify_breakpoint);
+  tui_inferior_exit_observer
+    = observer_attach_inferior_exit (tui_inferior_exit);

   deprecated_register_changed_hook = tui_register_changed_hook;
-  deprecated_detach_hook = tui_detach_hook;
 }

 /* Remove the TUI specific hooks.  */
@@ -292,7 +297,6 @@ tui_remove_hooks (void)
   deprecated_print_frame_info_listing_hook = 0;
   deprecated_query_hook = 0;
   deprecated_register_changed_hook = 0;
-  deprecated_detach_hook = 0;

   /* Remove our observers.  */
   observer_detach_breakpoint_created (tui_bp_created_observer);
@@ -301,6 +305,8 @@ tui_remove_hooks (void)
   tui_bp_deleted_observer = NULL;
   observer_detach_breakpoint_modified (tui_bp_modified_observer);
   tui_bp_modified_observer = NULL;
+  observer_detach_inferior_exit (tui_inferior_exit_observer);
+  tui_inferior_exit_observer = NULL;
 }

 void _initialize_tui_hooks (void);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]