diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-11 19:55:20 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-11 19:55:20 +0000 |
commit | 06d3b283b148a3ab8ff85a50fb127973524e700c (patch) | |
tree | 4ba2d7fb06e44c9d4f6276211f4378d0e99e8e8d /gdb | |
parent | 93ce7684566b4347cf4135f828dcffdb48417ebb (diff) | |
download | gdb-06d3b283b148a3ab8ff85a50fb127973524e700c.zip gdb-06d3b283b148a3ab8ff85a50fb127973524e700c.tar.gz gdb-06d3b283b148a3ab8ff85a50fb127973524e700c.tar.bz2 |
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).
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 38 | ||||
-rw-r--r-- | gdb/Makefile.in | 14 | ||||
-rw-r--r-- | gdb/aix-thread.c | 14 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/observer.texi | 7 | ||||
-rw-r--r-- | gdb/hpux-thread.c | 23 | ||||
-rw-r--r-- | gdb/linux-thread-db.c | 10 | ||||
-rwxr-xr-x | gdb/observer.sh | 1 | ||||
-rw-r--r-- | gdb/remote.c | 13 | ||||
-rw-r--r-- | gdb/rs6000-nat.c | 9 | ||||
-rw-r--r-- | gdb/sol-thread.c | 30 | ||||
-rw-r--r-- | gdb/symfile.c | 7 | ||||
-rw-r--r-- | gdb/target.h | 25 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.c | 9 |
14 files changed, 88 insertions, 116 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 28a42cb..77a3c64 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,43 @@ 2007-05-11 Ulrich Weigand <uweigand@de.ibm.com> + * 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). + +2007-05-11 Ulrich Weigand <uweigand@de.ibm.com> + * gdbarch.sh (remote_translate_xfer_address): Remove. * gdbarch.h, gdbarch.c: Regenerate. * arch-utils.c (generic_remote_translate_xfer_address): Remove. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 6beda5b..067b812 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1708,7 +1708,7 @@ ada-valprint.o: ada-valprint.c $(defs_h) $(gdb_string_h) $(symtab_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_h) $(inferior_h) $(regcache_h) \ $(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) $(inferior_h) $(target_h) $(gdb_string_h) \ 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) $(inferior_h) $(target_h) $(gdbcore_h) \ $(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) $(elf_external_h) $(elf_common_h) \ $(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 $(defs_h) $(ui_file_h) $(tui_file_h) \ 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 --git a/gdb/aix-thread.c b/gdb/aix-thread.c index e6d7a29..ccb275a 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -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 --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 19e7c61..e226b7a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2007-05-11 Ulrich Weigand <uweigand@de.ibm.com> + + * observer.texi (GDB Observers): New observer "new_objfile". + 2007-05-08 Ulrich Weigand <uweigand@de.ibm.com> * gdbint.texinfo (Native Conditionals): Remove USE_PROC_FS. diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index cff8faa..e4c99d8 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -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 --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index 71fe9f9..28920ba 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -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_file, char *allargs, char **env, 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 *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 --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 14cd088..787bec9 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 *objfile) { 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 --git a/gdb/observer.sh b/gdb/observer.sh index a32b380..cf3fe14 100755 --- a/gdb/observer.sh +++ b/gdb/observer.sh @@ -63,6 +63,7 @@ case $lang in struct observer; struct bpstats; struct so_list; +struct objfile; EOF ;; esac diff --git a/gdb/remote.c b/gdb/remote.c index 3dbb652..152ab66 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6350,20 +6350,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 @@ -6403,8 +6395,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 --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 9adc1fd..efb40e6 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -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 *target) 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 --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 16e3463..ee26b41 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -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_file, char *allargs, char **env, 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 *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 *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 --git a/gdb/symfile.c b/gdb/symfile.c index f9e8bfc..c5de30d 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -71,7 +71,6 @@ void (*deprecated_show_load_progress) (const char *section, 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 (bfd *abfd, int from_tty, 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 --git a/gdb/target.h b/gdb/target.h index 8796c08..24db136 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1007,31 +1007,6 @@ extern char *normal_pid_to_str (ptid_t ptid); #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 --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 4defb28..7114b01 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -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); } |