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]

[rfc] Replace deprecated_target_new_objfile_hook by observer


Hello,

this patch removes the deprecated_target_new_objfile_hook and replaces
it by a new observer "new_objfile".  The semantics remains completely
unchanged, so the patch is mostly just mechanical changes.

Tested on s390-ibm-linux, s390x-ibm-linux, and powerpc-ibm-aix5.3.0.0
and by making sure hpux-thread.o and sol-thread.o show no new compile
errors.

Eli, is the doc change OK?

Bye,
Ulrich


doc/ChangeLog:

	* observer.texi (GDB Observers): New observer "new_objfile".

ChangeLog:

	* observer.sh: Add "struct objfile" forward declaration.
	* target.h (deprecated_target_new_objfile_hook): Remove.
	* symfile.c (deprecated_target_new_objfile_hook): Remove.
	(clear_symtab_users): Call observer_notify_new_objfile.
	(symbol_file_add_with_addrs_or_offsets): Likewise.
	* rs6000-nat.c: Include "observer.h".
	(vmap_ldinfo): Call observer_notify_new_objfile.
	(xcoff_relocate_core): Likewise.
	* remote.c (remote_new_objfile_chain): Remove.
	(remote_new_objfile): Do not call remote_new_objfile_chain.
	(_initialize_remote): Use observer_attach_new_objfile.
	* tui/tui-hooks.c (tui_target_new_objfile_chain): Remove.
	(tui_new_objfile_hook): Do not call tui_target_new_objfile_chain.
	(_initialize_tui_hooks): Use observer_attach_new_objfile.
	* aix-thread.c: Include "observer.h".
	(target_new_objfile_chain): Remove.
	(new_objfile): Do not call target_new_objfile_chain.
	(_initialize_aix_thread): Use observer_attach_new_objfile.
	* hpux-thread.c: Include "observer.h"
	(target_new_objfile_chain): Remove.
	(hpux_thread_new_objfile): Make static.  Do not call
	target_new_objfile_chain.
	(_initialize_hpux_thread): Use observer_attach_new_objfile.
	* linux-thread-db.c: Include "observer.h".
	(target_new_objfile_chain): Remove.
	(thread_db_new_objfile): Do not call target_new_objfile_chain.
	(_initialize_thread_db): Use observer_attach_new_objfile.
	* sol-thread.c: Include "observer.h".
	(target_new_objfile_chain): Remove.
	(sol_thread_new_objfile): Make static.  Do not call
	target_new_objfile_chain.
	(_initialize_sol_thread): Use observer_attach_new_objfile.
	* Makefile.in (aix-thread.o, hpux-thread.o, linux-thread-db.o,
	rs6000-nat.o, sol-thread.o, tui-hooks.o): Add dependency on
	$(observer_h).


diff -urNp gdb-orig/gdb/aix-thread.c gdb-head/gdb/aix-thread.c
--- gdb-orig/gdb/aix-thread.c	2007-05-06 16:33:42.000000000 +0200
+++ gdb-head/gdb/aix-thread.c	2007-05-07 22:01:07.293446448 +0200
@@ -50,6 +50,7 @@
 #include "gdbcmd.h"
 #include "ppc-tdep.h"
 #include "gdb_string.h"
+#include "observer.h"
 
 #include <procinfo.h>
 #include <sys/types.h>
@@ -129,11 +130,6 @@ static int pd_active = 0;
 
 static int arch64;
 
-/* Saved pointer to previous owner of
-   deprecated_target_new_objfile_hook.  */
-
-static void (*target_new_objfile_chain)(struct objfile *);
-
 /* Forward declarations for pthdb callbacks.  */
 
 static int pdc_symbol_addrs (pthdb_user_t, pthdb_symbol_t *, int);
@@ -925,7 +921,7 @@ pd_disable (void)
   unpush_target (&aix_thread_ops);
 }
 
-/* deprecated_target_new_objfile_hook callback.
+/* new_objfile observer callback.
 
    If OBJFILE is non-null, check whether a threaded application is
    being debugged, and if so, prepare for thread debugging.
@@ -939,9 +935,6 @@ new_objfile (struct objfile *objfile)
     pd_enable ();
   else
     pd_disable ();
-
-  if (target_new_objfile_chain)
-    target_new_objfile_chain (objfile);
 }
 
 /* Attach to process specified by ARGS.  */
@@ -1792,8 +1785,7 @@ _initialize_aix_thread (void)
   add_target (&aix_thread_ops);
 
   /* Notice when object files get loaded and unloaded.  */
-  target_new_objfile_chain = deprecated_target_new_objfile_hook;
-  deprecated_target_new_objfile_hook = new_objfile;
+  observer_attach_new_objfile (new_objfile);
 
   add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread,
 			    _("Set debugging of AIX thread module."),
diff -urNp gdb-orig/gdb/doc/observer.texi gdb-head/gdb/doc/observer.texi
--- gdb-orig/gdb/doc/observer.texi	2007-03-16 01:51:51.000000000 +0100
+++ gdb-head/gdb/doc/observer.texi	2007-05-07 22:01:07.514547697 +0200
@@ -122,3 +122,10 @@ haven't been loaded yet.
 @deftypefun void solib_unloaded (struct so_list *@var{solib})
 The shared library specified by @var{solib} has been unloaded.
 @end deftypefun
+
+@deftypefun void new_objfile (struct objfile *@var{objfile})
+The symbol file specified by @var{objfile} has been loaded.
+Called with @var{objfile} equal to @code{NULL} to indicate
+previously loaded symbol table data has now been invalidated.
+@end deftypefun
+
diff -urNp gdb-orig/gdb/hpux-thread.c gdb-head/gdb/hpux-thread.c
--- gdb-orig/gdb/hpux-thread.c	2007-05-06 16:42:41.000000000 +0200
+++ gdb-head/gdb/hpux-thread.c	2007-05-07 22:01:07.335440404 +0200
@@ -48,6 +48,7 @@
 #include "gdb_stat.h"
 #include "gdbcore.h"
 #include "hppa-tdep.h"
+#include "observer.h"
 
 extern int child_suppress_run;
 
@@ -461,14 +462,7 @@ hpux_thread_create_inferior (char *exec_
    those variables don't show up until the library gets mapped and the symbol
    table is read in.  */
 
-/* This new_objfile event is now managed by a chained function pointer. 
- * It is the callee's responsability to call the next client on the chain.
- */
-
-/* Saved pointer to previous owner of the new_objfile event. */
-static void (*target_new_objfile_chain) (struct objfile *);
-
-void
+static void
 hpux_thread_new_objfile (struct objfile *objfile)
 {
   struct minimal_symbol *ms;
@@ -476,28 +470,24 @@ hpux_thread_new_objfile (struct objfile 
   if (!objfile)
     {
       hpux_thread_active = 0;
-      goto quit;
+      return;
     }
 
   ms = lookup_minimal_symbol ("cma__g_known_threads", NULL, objfile);
 
   if (!ms)
-    goto quit;
+    return;
 
   P_cma__g_known_threads = SYMBOL_VALUE_ADDRESS (ms);
 
   ms = lookup_minimal_symbol ("cma__g_current_thread", NULL, objfile);
 
   if (!ms)
-    goto quit;
+    return;
 
   P_cma__g_current_thread = SYMBOL_VALUE_ADDRESS (ms);
 
   hpux_thread_active = 1;
-quit:
-  /* Call predecessor on chain, if any. */
-  if (target_new_objfile_chain)
-    target_new_objfile_chain (objfile);
 }
 
 /* Clean up after the inferior dies.  */
@@ -589,6 +579,5 @@ _initialize_hpux_thread (void)
 
   child_suppress_run = 1;
   /* Hook into new_objfile notification.  */
-  target_new_objfile_chain = deprecated_target_new_objfile_hook;
-  deprecated_target_new_objfile_hook  = hpux_thread_new_objfile;
+  observer_attach_new_objfile (hpux_thread_new_objfile);
 }
diff -urNp gdb-orig/gdb/linux-thread-db.c gdb-head/gdb/linux-thread-db.c
--- gdb-orig/gdb/linux-thread-db.c	2007-05-07 20:13:52.389020000 +0200
+++ gdb-head/gdb/linux-thread-db.c	2007-05-07 22:02:21.538079231 +0200
@@ -37,6 +37,7 @@
 #include "regcache.h"
 #include "solib-svr4.h"
 #include "gdbcore.h"
+#include "observer.h"
 #include "linux-nat.h"
 
 #include <signal.h>
@@ -58,9 +59,6 @@ static struct target_ops thread_db_ops;
 /* The target vector that we call for things this module can't handle.  */
 static struct target_ops *target_beneath;
 
-/* Pointer to the next function on the objfile event chain.  */
-static void (*target_new_objfile_chain) (struct objfile * objfile);
-
 /* Non-zero if we're using this module's target vector.  */
 static int using_thread_db;
 
@@ -650,9 +648,6 @@ thread_db_new_objfile (struct objfile *o
 {
   if (objfile != NULL)
     check_for_thread_db ();
-
-  if (target_new_objfile_chain)
-    target_new_objfile_chain (objfile);
 }
 
 /* Attach to a new thread.  This function is called when we receive a
@@ -1140,7 +1135,6 @@ _initialize_thread_db (void)
       add_target (&thread_db_ops);
 
       /* Add ourselves to objfile event chain.  */
-      target_new_objfile_chain = deprecated_target_new_objfile_hook;
-      deprecated_target_new_objfile_hook = thread_db_new_objfile;
+      observer_attach_new_objfile (thread_db_new_objfile);
     }
 }
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-05-07 20:13:52.203047000 +0200
+++ gdb-head/gdb/Makefile.in	2007-05-07 22:02:37.032245370 +0200
@@ -1708,7 +1708,7 @@ ada-valprint.o: ada-valprint.c $(defs_h)
 	$(exceptions_h)
 aix-thread.o: aix-thread.c $(defs_h) $(gdb_assert_h) $(gdbthread_h) \
 	$(target_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) $(ppc_tdep_h) \
-	$(gdb_string_h)
+	$(gdb_string_h) $(observer_h)
 alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(alpha_tdep_h) $(alphabsd_tdep_h) $(inf_ptrace_h) $(gregset_h) \
 	$(bsd_kvm_h)
@@ -2080,7 +2080,7 @@ hppa-tdep.o: hppa-tdep.c $(defs_h) $(bfd
 	$(hppa_tdep_h) $(gdbtypes_h)
 hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
 	$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) \
-	$(hppa_tdep_h)
+	$(hppa_tdep_h) $(observer_h)
 i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h) $(i386bsd_nat_h) \
 	$(inf_ptrace_h)
@@ -2226,7 +2226,7 @@ linux-nat.o: linux-nat.c $(defs_h) $(inf
 linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
 	$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
 	$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
-	$(regcache_h) $(solib_svr4_h) $(gdbcore_h) $(linux_nat_h)
+	$(regcache_h) $(solib_svr4_h) $(gdbcore_h) $(observer_h) $(linux_nat_h)
 m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
 	$(value_h) $(parser_defs_h) $(m2_lang_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(block_h)
@@ -2505,7 +2505,7 @@ rs6000-nat.o: rs6000-nat.c $(defs_h) $(i
 	$(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \
 	$(exceptions_h) $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) \
 	$(inf_ptrace_h) $(ppc_tdep_h) $(rs6000_tdep_h) $(exec_h) \
-	$(gdb_stdint_h) $(gdb_stat_h)
+	$(gdb_stdint_h) $(observer_h) $(gdb_stat_h)
 rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
 	$(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \
 	$(regcache_h) $(regset_h) $(doublest_h) $(value_h) $(parser_defs_h) \
@@ -2596,7 +2596,7 @@ solib-svr4.o: solib-svr4.c $(defs_h) $(e
 	$(exec_h)
 sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
 	$(inferior_h) $(gdb_stat_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) \
-	$(solib_h) $(symfile_h) $(gdb_string_h) $(gregset_h)
+	$(solib_h) $(symfile_h) $(observer_h) $(gdb_string_h) $(gregset_h)
 somread.o: somread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
 	$(objfiles_h) $(buildsym_h) $(stabsread_h) $(gdb_stabs_h) \
 	$(complaints_h) $(gdb_string_h) $(demangle_h) $(som_h) $(libhppa_h) \
@@ -3126,8 +3126,8 @@ tui-file.o: $(srcdir)/tui/tui-file.c $(d
 tui-hooks.o: $(srcdir)/tui/tui-hooks.c $(defs_h) $(symtab_h) $(inferior_h) \
 	$(command_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(target_h) \
 	$(gdbcore_h) $(event_loop_h) $(event_top_h) $(frame_h) \
-	$(breakpoint_h) $(gdb_events_h) $(ui_out_h) $(top_h) $(tui_h) \
-	$(tui_hooks_h) $(tui_data_h) $(tui_layout_h) $(tui_io_h) \
+	$(breakpoint_h) $(gdb_events_h) $(ui_out_h) $(top_h) $(observer_h) \
+	$(tui_h) $(tui_hooks_h) $(tui_data_h) $(tui_layout_h) $(tui_io_h) \
 	$(tui_regs_h) $(tui_win_h) $(tui_stack_h) $(tui_windata_h) \
 	$(tui_winsource_h) $(gdb_curses_h) $(readline_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-hooks.c
diff -urNp gdb-orig/gdb/observer.sh gdb-head/gdb/observer.sh
--- gdb-orig/gdb/observer.sh	2007-03-16 01:51:51.000000000 +0100
+++ gdb-head/gdb/observer.sh	2007-05-07 22:01:07.355437527 +0200
@@ -63,6 +63,7 @@ case $lang in
 struct observer;
 struct bpstats;
 struct so_list;
+struct objfile;
 EOF
         ;;
 esac
diff -urNp gdb-orig/gdb/remote.c gdb-head/gdb/remote.c
--- gdb-orig/gdb/remote.c	2007-05-06 21:06:21.000000000 +0200
+++ gdb-head/gdb/remote.c	2007-05-07 22:01:07.378567266 +0200
@@ -6358,20 +6358,12 @@ build_remote_gdbarch_data (void)
   remote_address_size = TARGET_ADDR_BIT;
 }
 
-/* Saved pointer to previous owner of the new_objfile event.  */
-static void (*remote_new_objfile_chain) (struct objfile *);
-
 /* Function to be called whenever a new objfile (shlib) is detected.  */
 static void
 remote_new_objfile (struct objfile *objfile)
 {
   if (remote_desc != 0)		/* Have a remote connection.  */
-    {
-      remote_check_symbols (objfile);
-    }
-  /* Call predecessor on chain, if any.  */
-  if (remote_new_objfile_chain)
-    remote_new_objfile_chain (objfile);
+    remote_check_symbols (objfile);
 }
 
 void
@@ -6411,8 +6403,7 @@ _initialize_remote (void)
   add_target (&extended_async_remote_ops);
 
   /* Hook into new objfile notification.  */
-  remote_new_objfile_chain = deprecated_target_new_objfile_hook;
-  deprecated_target_new_objfile_hook  = remote_new_objfile;
+  observer_attach_new_objfile (remote_new_objfile);
 
 #if 0
   init_remote_threadtests ();
diff -urNp gdb-orig/gdb/rs6000-nat.c gdb-head/gdb/rs6000-nat.c
--- gdb-orig/gdb/rs6000-nat.c	2007-05-06 16:33:43.000000000 +0200
+++ gdb-head/gdb/rs6000-nat.c	2007-05-07 22:01:44.705787420 +0200
@@ -39,6 +39,7 @@
 #include "rs6000-tdep.h"
 #include "exec.h"
 #include "gdb_stdint.h"
+#include "observer.h"
 
 #include <sys/ptrace.h>
 #include <sys/reg.h>
@@ -880,8 +881,8 @@ vmap_ldinfo (LdInfo *ldi)
 
 	  /* Announce new object files.  Doing this after symbol relocation
 	     makes aix-thread.c's job easier.  */
-	  if (deprecated_target_new_objfile_hook && vp->objfile)
-	    deprecated_target_new_objfile_hook (vp->objfile);
+	  if (vp->objfile)
+	    observer_notify_new_objfile (vp->objfile);
 
 	  /* There may be more, so we don't break out of the loop.  */
 	}
@@ -1164,8 +1165,8 @@ xcoff_relocate_core (struct target_ops *
 
       vmap_symtab (vp);
 
-      if (deprecated_target_new_objfile_hook && vp != vmap && vp->objfile)
-	deprecated_target_new_objfile_hook (vp->objfile);
+      if (vp != vmap && vp->objfile)
+	observer_notify_new_objfile (vp->objfile);
     }
   while (LDI_NEXT (ldi, arch64) != 0);
   vmap_exec ();
diff -urNp gdb-orig/gdb/sol-thread.c gdb-head/gdb/sol-thread.c
--- gdb-orig/gdb/sol-thread.c	2007-05-06 16:42:41.000000000 +0200
+++ gdb-head/gdb/sol-thread.c	2007-05-07 22:01:07.442558057 +0200
@@ -66,6 +66,7 @@
 #include "regcache.h"
 #include "solib.h"
 #include "symfile.h"
+#include "observer.h"
 
 #include "gdb_string.h"
 
@@ -777,16 +778,9 @@ sol_thread_create_inferior (char *exec_f
    when all symbol tables are removed.  libthread_db can only be
    initialized when it finds the right variables in libthread.so.
    Since it's a shared library, those variables don't show up until
-   the library gets mapped and the symbol table is read in.
+   the library gets mapped and the symbol table is read in.  */
 
-   This new_objfile event is managed by a chained function pointer.
-   It is the callee's responsability to call the next client on the
-   chain.  */
-
-/* Saved pointer to previous owner of the new_objfile event. */
-static void (*target_new_objfile_chain) (struct objfile *);
-
-void
+static void
 sol_thread_new_objfile (struct objfile *objfile)
 {
   td_err_e val;
@@ -794,13 +788,13 @@ sol_thread_new_objfile (struct objfile *
   if (!objfile)
     {
       sol_thread_active = 0;
-      goto quit;
+      return;
     }
 
   /* Don't do anything if init failed to resolve the libthread_db
      library.  */
   if (!procfs_suppress_run)
-    goto quit;
+    return;
 
   /* Now, initialize libthread_db.  This needs to be done after the
      shared libraries are located because it needs information from
@@ -810,24 +804,19 @@ sol_thread_new_objfile (struct objfile *
   if (val != TD_OK)
     {
       warning (_("sol_thread_new_objfile: td_init: %s"), td_err_string (val));
-      goto quit;
+      return;
     }
 
   val = p_td_ta_new (&main_ph, &main_ta);
   if (val == TD_NOLIBTHREAD)
-    goto quit;
+    return;
   else if (val != TD_OK)
     {
       warning (_("sol_thread_new_objfile: td_ta_new: %s"), td_err_string (val));
-      goto quit;
+      return;
     }
 
   sol_thread_active = 1;
-
-quit:
-  /* Call predecessor on chain, if any.  */
-  if (target_new_objfile_chain)
-    target_new_objfile_chain (objfile);
 }
 
 /* Clean up after the inferior dies.  */
@@ -1667,8 +1656,7 @@ _initialize_sol_thread (void)
   add_target (&core_ops);
 
   /* Hook into new_objfile notification.  */
-  target_new_objfile_chain = deprecated_target_new_objfile_hook;
-  deprecated_target_new_objfile_hook  = sol_thread_new_objfile;
+  observer_attach_new_objfile (sol_thread_new_objfile);
   return;
 
  die:
diff -urNp gdb-orig/gdb/symfile.c gdb-head/gdb/symfile.c
--- gdb-orig/gdb/symfile.c	2007-04-13 19:13:46.000000000 +0200
+++ gdb-head/gdb/symfile.c	2007-05-07 22:01:07.452556618 +0200
@@ -71,7 +71,6 @@ void (*deprecated_show_load_progress) (c
 			    unsigned long total_size);
 void (*deprecated_pre_add_symbol_hook) (const char *);
 void (*deprecated_post_add_symbol_hook) (void);
-void (*deprecated_target_new_objfile_hook) (struct objfile *);
 
 static void clear_symtab_users_cleanup (void *ignore);
 
@@ -1067,8 +1066,7 @@ symbol_file_add_with_addrs_or_offsets (b
 
   new_symfile_objfile (objfile, mainline, from_tty);
 
-  if (deprecated_target_new_objfile_hook)
-    deprecated_target_new_objfile_hook (objfile);
+  observer_notify_new_objfile (objfile);
 
   bfd_cache_close_all ();
   return (objfile);
@@ -2643,8 +2641,7 @@ clear_symtab_users (void)
   breakpoint_re_set ();
   set_default_breakpoint (0, 0, 0, 0);
   clear_pc_function_cache ();
-  if (deprecated_target_new_objfile_hook)
-    deprecated_target_new_objfile_hook (NULL);
+  observer_notify_new_objfile (NULL);
 
   /* Clear globals which might have pointed into a removed objfile.
      FIXME: It's not clear which of these are supposed to persist
diff -urNp gdb-orig/gdb/target.h gdb-head/gdb/target.h
--- gdb-orig/gdb/target.h	2007-05-07 02:19:48.000000000 +0200
+++ gdb-head/gdb/target.h	2007-05-07 22:01:07.509548416 +0200
@@ -1007,31 +1007,6 @@ extern char *normal_pid_to_str (ptid_t p
 #define target_extra_thread_info(TP) \
      (current_target.to_extra_thread_info (TP))
 
-/*
- * New Objfile Event Hook:
- *
- * Sometimes a GDB component wants to get notified whenever a new
- * objfile is loaded.  Mainly this is used by thread-debugging
- * implementations that need to know when symbols for the target
- * thread implemenation are available.
- *
- * The old way of doing this is to define a macro 'target_new_objfile'
- * that points to the function that you want to be called on every
- * objfile/shlib load.
-
-   The new way is to grab the function pointer,
-   'deprecated_target_new_objfile_hook', and point it to the function
-   that you want to be called on every objfile/shlib load.
-
-   If multiple clients are willing to be cooperative, they can each
-   save a pointer to the previous value of
-   deprecated_target_new_objfile_hook before modifying it, and arrange
-   for their function to call the previous function in the chain.  In
-   that way, multiple clients can receive this notification (something
-   like with signal handlers).  */
-
-extern void (*deprecated_target_new_objfile_hook) (struct objfile *);
-
 #ifndef target_pid_or_tid_to_str
 #define target_pid_or_tid_to_str(ID) \
      target_pid_to_str (ID)
diff -urNp gdb-orig/gdb/tui/tui-hooks.c gdb-head/gdb/tui/tui-hooks.c
--- gdb-orig/gdb/tui/tui-hooks.c	2007-03-29 22:50:29.000000000 +0200
+++ gdb-head/gdb/tui/tui-hooks.c	2007-05-07 22:01:07.519546977 +0200
@@ -36,6 +36,7 @@
 #include "gdb-events.h"
 #include "ui-out.h"
 #include "top.h"
+#include "observer.h"
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -59,16 +60,11 @@
 
 int tui_target_has_run = 0;
 
-static void (* tui_target_new_objfile_chain) (struct objfile*);
-
 static void
 tui_new_objfile_hook (struct objfile* objfile)
 {
   if (tui_active)
     tui_display_main ();
-  
-  if (tui_target_new_objfile_chain)
-    tui_target_new_objfile_chain (objfile);
 }
 
 static int ATTR_FORMAT (printf, 1, 0)
@@ -302,6 +298,5 @@ void
 _initialize_tui_hooks (void)
 {
   /* Install the permanent hooks.  */
-  tui_target_new_objfile_chain = deprecated_target_new_objfile_hook;
-  deprecated_target_new_objfile_hook = tui_new_objfile_hook;
+  observer_attach_new_objfile (tui_new_objfile_hook);
 }
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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