diff mbox

[RFA,3/4] Update all observer uses

Message ID 1475468542-11446-4-git-send-email-tom@tromey.com
State New
Headers show

Commit Message

Tom Tromey Oct. 3, 2016, 4:22 a.m. UTC
This updates all the uses of observers to the new API.
This patch was generated using this perl script:

perl -pi~ -e 's/observer_(attach|notify|detach)_([a-z_]+)/gdb_observers::\2.\1/g;' \
    *.[chyl] */*.[chyl]

2016-10-02  Tom Tromey  <tom@tromey.com>

	* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
	arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
	breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
	corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
	extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
	infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
	linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
	mi/mi-cmd-break.c, mi/mi-interp.c, objfiles.c, ppc-linux-nat.c,
	ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c,
	python/py-finishbreakpoint.c, python/py-inferior.c,
	python/py-unwind.c, ravenscar-thread.c, record-btrace.c,
	record-full.c, record.c, regcache.c, remote.c, sol-thread.c,
	solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c,
	symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c,
	tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users.
---
 gdb/ChangeLog                    | 16 ++++++++++++
 gdb/ada-lang.c                   |  6 ++---
 gdb/ada-tasks.c                  |  4 +--
 gdb/agent.c                      |  2 +-
 gdb/aix-thread.c                 |  4 +--
 gdb/annotate.c                   |  6 ++---
 gdb/arm-tdep.c                   |  2 +-
 gdb/auto-load.c                  |  4 +--
 gdb/auxv.c                       |  6 ++---
 gdb/break-catch-syscall.c        |  2 +-
 gdb/breakpoint.c                 | 50 ++++++++++++++++++-------------------
 gdb/bsd-uthread.c                |  6 ++---
 gdb/cli/cli-interp.c             | 16 ++++++------
 gdb/cli/cli-setshow.c            | 10 ++++----
 gdb/corefile.c                   |  2 +-
 gdb/dummy-frame.c                |  2 +-
 gdb/event-loop.c                 |  2 +-
 gdb/event-top.c                  |  2 +-
 gdb/exec.c                       |  2 +-
 gdb/extension.c                  |  2 +-
 gdb/frame.c                      |  2 +-
 gdb/gdbarch.c                    |  2 +-
 gdb/guile/scm-breakpoint.c       |  4 +--
 gdb/infcall.c                    |  4 +--
 gdb/infcmd.c                     |  2 +-
 gdb/inferior.c                   |  8 +++---
 gdb/inflow.c                     |  2 +-
 gdb/infrun.c                     | 26 +++++++++----------
 gdb/jit.c                        |  6 ++---
 gdb/linux-tdep.c                 |  4 +--
 gdb/linux-thread-db.c            |  6 ++---
 gdb/m68klinux-tdep.c             |  2 +-
 gdb/mi/mi-cmd-break.c            |  4 +--
 gdb/mi/mi-interp.c               | 54 ++++++++++++++++++++--------------------
 gdb/objfiles.c                   |  2 +-
 gdb/ppc-linux-nat.c              |  2 +-
 gdb/ppc-linux-tdep.c             |  6 ++---
 gdb/printcmd.c                   |  2 +-
 gdb/procfs.c                     |  2 +-
 gdb/python/py-breakpoint.c       |  6 ++---
 gdb/python/py-finishbreakpoint.c |  4 +--
 gdb/python/py-inferior.c         | 20 +++++++--------
 gdb/python/py-unwind.c           |  2 +-
 gdb/ravenscar-thread.c           |  2 +-
 gdb/record-btrace.c              |  6 ++---
 gdb/record-full.c                |  2 +-
 gdb/record.c                     |  2 +-
 gdb/regcache.c                   |  4 +--
 gdb/remote.c                     |  8 +++---
 gdb/sol-thread.c                 |  2 +-
 gdb/solib-aix.c                  |  2 +-
 gdb/solib-spu.c                  |  2 +-
 gdb/solib.c                      |  8 +++---
 gdb/spu-multiarch.c              |  6 ++---
 gdb/spu-tdep.c                   |  6 ++---
 gdb/symfile-mem.c                |  2 +-
 gdb/symfile.c                    | 14 +++++------
 gdb/symtab.c                     |  6 ++---
 gdb/thread.c                     | 18 +++++++-------
 gdb/top.c                        |  2 +-
 gdb/tracepoint.c                 | 16 ++++++------
 gdb/tui/tui-hooks.c              | 30 +++++++++++-----------
 gdb/tui/tui-interp.c             | 16 ++++++------
 gdb/valops.c                     |  4 +--
 64 files changed, 246 insertions(+), 230 deletions(-)
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8265310..fb84728 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@ 
 2016-10-02  Tom Tromey  <tom@tromey.com>
 
+	* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
+	arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
+	breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
+	corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
+	extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
+	infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
+	linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
+	mi/mi-cmd-break.c, mi/mi-interp.c, objfiles.c, ppc-linux-nat.c,
+	ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c,
+	python/py-finishbreakpoint.c, python/py-inferior.c,
+	python/py-unwind.c, ravenscar-thread.c, record-btrace.c,
+	record-full.c, record.c, regcache.c, remote.c, sol-thread.c,
+	solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c,
+	symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c,
+	tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users.
+
 	* tui/tui-hooks.c (tui_bp_created_observer)
 	(tui_bp_deleted_observer, tui_bp_modified_observer)
 	(tui_inferior_exit_observer, tui_before_prompt_observer)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index be2f47a..782db36 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -14314,9 +14314,9 @@  DWARF attribute."),
      NULL, xcalloc, xfree);
 
   /* The ada-lang observers.  */
-  observer_attach_new_objfile (ada_new_objfile_observer);
-  observer_attach_free_objfile (ada_free_objfile_observer);
-  observer_attach_inferior_exit (ada_inferior_exit);
+  gdb_observers::new_objfile.attach (ada_new_objfile_observer);
+  gdb_observers::free_objfile.attach (ada_free_objfile_observer);
+  gdb_observers::inferior_exit.attach (ada_inferior_exit);
 
   /* Setup various context-specific data.  */
   ada_inferior_data
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index c067ae6..78425e3 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1441,8 +1441,8 @@  _initialize_tasks (void)
   ada_tasks_inferior_data_handle = register_inferior_data ();
 
   /* Attach various observers.  */
-  observer_attach_normal_stop (ada_tasks_normal_stop_observer);
-  observer_attach_new_objfile (ada_tasks_new_objfile_observer);
+  gdb_observers::normal_stop.attach (ada_tasks_normal_stop_observer);
+  gdb_observers::new_objfile.attach (ada_tasks_new_objfile_observer);
 
   /* Some new commands provided by this module.  */
   add_info ("tasks", info_tasks_command,
diff --git a/gdb/agent.c b/gdb/agent.c
index 8899b77..7bc8cce 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -69,7 +69,7 @@  agent_new_objfile (struct objfile *objfile)
 void
 _initialize_agent (void)
 {
-  observer_attach_new_objfile (agent_new_objfile);
+  gdb_observers::new_objfile.attach (agent_new_objfile);
 
   add_setshow_enum_cmd ("agent", class_run,
 			can_use_agent_enum,
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 693d6f6..b7d08a6 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1845,11 +1845,11 @@  _initialize_aix_thread (void)
   complete_target_initialization (&aix_thread_ops);
 
   /* Notice when object files get loaded and unloaded.  */
-  observer_attach_new_objfile (new_objfile);
+  gdb_observers::new_objfile.attach (new_objfile);
 
   /* Add ourselves to inferior_created event chain.
      This is needed to enable the thread target on "attach".  */
-  observer_attach_inferior_created (aix_thread_inferior_created);
+  gdb_observers::inferior_created.attach (aix_thread_inferior_created);
 
   add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread,
 			   _("Set debugging of AIX thread module."),
diff --git a/gdb/annotate.c b/gdb/annotate.c
index 64175a4..d4864ba 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -594,7 +594,7 @@  breakpoint_changed (struct breakpoint *b)
 void
 _initialize_annotate (void)
 {
-  observer_attach_breakpoint_created (breakpoint_changed);
-  observer_attach_breakpoint_deleted (breakpoint_changed);
-  observer_attach_breakpoint_modified (breakpoint_changed);
+  gdb_observers::breakpoint_created.attach (breakpoint_changed);
+  gdb_observers::breakpoint_deleted.attach (breakpoint_changed);
+  gdb_observers::breakpoint_modified.attach (breakpoint_changed);
 }
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index a07d93b..14e2193 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9568,7 +9568,7 @@  _initialize_arm_tdep (void)
     = register_objfile_data_with_cleanup (NULL, arm_objfile_data_free);
 
   /* Add ourselves to objfile event chain.  */
-  observer_attach_new_objfile (arm_exidx_new_objfile);
+  gdb_observers::new_objfile.attach (arm_exidx_new_objfile);
   arm_exidx_data_key
     = register_objfile_data_with_cleanup (NULL, arm_exidx_data_free);
 
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index de64112..c0fc9ee 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1615,7 +1615,7 @@  _initialize_auto_load (void)
     = register_program_space_data_with_cleanup (NULL,
 						auto_load_pspace_data_cleanup);
 
-  observer_attach_new_objfile (auto_load_new_objfile);
+  gdb_observers::new_objfile.attach (auto_load_new_objfile);
 
   add_setshow_boolean_cmd ("gdb-scripts", class_support,
 			   &auto_load_gdb_scripts, _("\
@@ -1725,7 +1725,7 @@  This options has security implications for untrusted inferiors."),
 				     show_auto_load_safe_path,
 				     auto_load_set_cmdlist_get (),
 				     auto_load_show_cmdlist_get ());
-  observer_attach_gdb_datadir_changed (auto_load_gdb_datadir_changed);
+  gdb_observers::gdb_datadir_changed.attach (auto_load_gdb_datadir_changed);
 
   cmd = add_cmd ("add-auto-load-safe-path", class_support,
 		 add_auto_load_safe_path,
diff --git a/gdb/auxv.c b/gdb/auxv.c
index de9205d..6f2d882 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -582,7 +582,7 @@  This is information provided by the operating system at program startup."));
     = register_inferior_data_with_cleanup (NULL, auxv_inferior_data_cleanup);
 
   /* Observers used to invalidate the auxv cache when needed.  */
-  observer_attach_inferior_exit (invalidate_auxv_cache_inf);
-  observer_attach_inferior_appeared (invalidate_auxv_cache_inf);
-  observer_attach_executable_changed (invalidate_auxv_cache);
+  gdb_observers::inferior_exit.attach (invalidate_auxv_cache_inf);
+  gdb_observers::inferior_appeared.attach (invalidate_auxv_cache_inf);
+  gdb_observers::executable_changed.attach (invalidate_auxv_cache);
 }
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 63b8cd2..de4d2f0 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -718,7 +718,7 @@  _initialize_break_catch_syscall (void)
 {
   initialize_syscall_catchpoint_ops ();
 
-  observer_attach_inferior_exit (clear_syscall_counts);
+  gdb_observers::inferior_exit.attach (clear_syscall_counts);
   catch_syscall_inferior_data
     = register_inferior_data_with_cleanup (NULL,
 					   catch_syscall_inferior_data_cleanup);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1e05932..fbbe7d1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1040,7 +1040,7 @@  set_breakpoint_condition (struct breakpoint *b, const char *exp,
     }
   mark_breakpoint_modified (b);
 
-  observer_notify_breakpoint_modified (b);
+  gdb_observers::breakpoint_modified.notify (b);
 }
 
 /* Completion for the "condition" command.  */
@@ -1278,7 +1278,7 @@  breakpoint_set_commands (struct breakpoint *b,
 
   decref_counted_command_line (&b->commands);
   b->commands = alloc_counted_command_line (commands);
-  observer_notify_breakpoint_modified (b);
+  gdb_observers::breakpoint_modified.notify (b);
 }
 
 /* Set the internal `silent' flag on the breakpoint.  Note that this
@@ -1292,7 +1292,7 @@  breakpoint_set_silent (struct breakpoint *b, int silent)
 
   b->silent = silent;
   if (old_silent != silent)
-    observer_notify_breakpoint_modified (b);
+    gdb_observers::breakpoint_modified.notify (b);
 }
 
 /* Set the thread for this breakpoint.  If THREAD is -1, make the
@@ -1305,7 +1305,7 @@  breakpoint_set_thread (struct breakpoint *b, int thread)
 
   b->thread = thread;
   if (old_thread != thread)
-    observer_notify_breakpoint_modified (b);
+    gdb_observers::breakpoint_modified.notify (b);
 }
 
 /* Set the task for this breakpoint.  If TASK is 0, make the
@@ -1318,7 +1318,7 @@  breakpoint_set_task (struct breakpoint *b, int task)
 
   b->task = task;
   if (old_task != task)
-    observer_notify_breakpoint_modified (b);
+    gdb_observers::breakpoint_modified.notify (b);
 }
 
 void
@@ -1394,7 +1394,7 @@  do_map_commands_command (struct breakpoint *b, void *data)
       incref_counted_command_line (info->cmd);
       decref_counted_command_line (&b->commands);
       b->commands = info->cmd;
-      observer_notify_breakpoint_modified (b);
+      gdb_observers::breakpoint_modified.notify (b);
     }
 }
 
@@ -2828,7 +2828,7 @@  insert_bp_location (struct bp_location *bl,
 	    {
 	      /* See also: disable_breakpoints_in_shlibs.  */
 	      bl->shlib_disabled = 1;
-	      observer_notify_breakpoint_modified (bl->owner);
+	      gdb_observers::breakpoint_modified.notify (bl->owner);
 	      if (!*disabled_breaks)
 		{
 		  fprintf_unfiltered (tmp_error_stream, 
@@ -5593,7 +5593,7 @@  bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
       bs->stop = 0;
       /* Increase the hit count even though we don't stop.  */
       ++(b->hit_count);
-      observer_notify_breakpoint_modified (b);
+      gdb_observers::breakpoint_modified.notify (b);
     }	
 }
 
@@ -5748,7 +5748,7 @@  bpstat_stop_status (struct address_space *aspace,
 	  if (bs->stop)
 	    {
 	      ++(b->hit_count);
-	      observer_notify_breakpoint_modified (b);
+	      gdb_observers::breakpoint_modified.notify (b);
 
 	      /* We will stop here.  */
 	      if (b->disposition == disp_disable)
@@ -7991,7 +7991,7 @@  disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
 	loc->inserted = 0;
 
 	/* This may cause duplicate notifications for the same breakpoint.  */
-	observer_notify_breakpoint_modified (b);
+	gdb_observers::breakpoint_modified.notify (b);
 
 	if (!disabled_shlib_breaks)
 	  {
@@ -8074,7 +8074,7 @@  disable_breakpoints_in_freed_objfile (struct objfile *objfile)
 	}
 
       if (bp_modified)
-	observer_notify_breakpoint_modified (b);
+	gdb_observers::breakpoint_modified.notify (b);
     }
 }
 
@@ -8642,7 +8642,7 @@  install_breakpoint (int internal, struct breakpoint *b, int update_gll)
     set_tracepoint_count (breakpoint_count);
   if (!internal)
     mention (b);
-  observer_notify_breakpoint_created (b);
+  gdb_observers::breakpoint_created.notify (b);
 
   if (update_gll)
     update_global_location_list (UGLL_MAY_INSERT);
@@ -10526,7 +10526,7 @@  break_range_command (char *arg, int from_tty)
   do_cleanups (cleanup_bkpt);
 
   mention (b);
-  observer_notify_breakpoint_created (b);
+  gdb_observers::breakpoint_created.notify (b);
   update_global_location_list (UGLL_MAY_INSERT);
 }
 
@@ -12340,7 +12340,7 @@  download_tracepoint_locations (void)
       t = (struct tracepoint *) b;
       t->number_on_target = b->number;
       if (bp_location_downloaded)
-	observer_notify_breakpoint_modified (b);
+	gdb_observers::breakpoint_modified.notify (b);
     }
 
   do_cleanups (old_chain);
@@ -13898,7 +13898,7 @@  delete_breakpoint (struct breakpoint *bpt)
      a problem in that process, we'll be asked to delete the half-created
      watchpoint.  In that case, don't announce the deletion.  */
   if (bpt->number)
-    observer_notify_breakpoint_deleted (bpt);
+    gdb_observers::breakpoint_deleted.notify (bpt);
 
   if (breakpoint_chain == bpt)
     breakpoint_chain = bpt->next;
@@ -14406,7 +14406,7 @@  update_breakpoint_locations (struct breakpoint *b,
   }
 
   if (!locations_are_equal (existing_locations, b->loc))
-    observer_notify_breakpoint_modified (b);
+    gdb_observers::breakpoint_modified.notify (b);
 }
 
 /* Find the SaL locations corresponding to the given LOCATION.
@@ -14734,7 +14734,7 @@  set_ignore_count (int bptnum, int count, int from_tty)
 			       "crossings of breakpoint %d."),
 			     count, bptnum);
 	}
-      observer_notify_breakpoint_modified (b);
+      gdb_observers::breakpoint_modified.notify (b);
       return;
     }
 
@@ -14880,7 +14880,7 @@  disable_breakpoint (struct breakpoint *bpt)
 
   update_global_location_list (UGLL_DONT_INSERT);
 
-  observer_notify_breakpoint_modified (bpt);
+  gdb_observers::breakpoint_modified.notify (bpt);
 }
 
 /* A callback for iterate_over_related_breakpoints.  */
@@ -15002,7 +15002,7 @@  enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
   bpt->enable_count = count;
   update_global_location_list (UGLL_MAY_INSERT);
 
-  observer_notify_breakpoint_modified (bpt);
+  gdb_observers::breakpoint_modified.notify (bpt);
 }
 
 
@@ -15537,7 +15537,7 @@  static void
 trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
 {
   tp->pass_count = count;
-  observer_notify_breakpoint_modified (&tp->base);
+  gdb_observers::breakpoint_modified.notify (&tp->base);
   if (from_tty)
     printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
 		     tp->base.number, count);
@@ -16183,9 +16183,9 @@  _initialize_breakpoint (void)
 
   initialize_breakpoint_ops ();
 
-  observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
-  observer_attach_free_objfile (disable_breakpoints_in_freed_objfile);
-  observer_attach_memory_changed (invalidate_bp_value_on_memory_change);
+  gdb_observers::solib_unloaded.attach (disable_breakpoints_in_unloaded_shlib);
+  gdb_observers::free_objfile.attach (disable_breakpoints_in_freed_objfile);
+  gdb_observers::memory_changed.attach (invalidate_bp_value_on_memory_change);
 
   breakpoint_objfile_key
     = register_objfile_data_with_cleanup (NULL, free_breakpoint_probes);
@@ -16734,6 +16734,6 @@  agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
 
   automatic_hardware_breakpoints = 1;
 
-  observer_attach_about_to_proceed (breakpoint_about_to_proceed);
-  observer_attach_thread_exit (remove_threaded_breakpoints);
+  gdb_observers::about_to_proceed.attach (breakpoint_about_to_proceed);
+  gdb_observers::thread_exit.attach (remove_threaded_breakpoints);
 }
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 4ce0a6c..dba0b3b 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -545,7 +545,7 @@  _initialize_bsd_uthread (void)
 
   bsd_uthread_data = gdbarch_data_register_pre_init (bsd_uthread_init);
 
-  observer_attach_inferior_created (bsd_uthread_inferior_created);
-  observer_attach_solib_loaded (bsd_uthread_solib_loaded);
-  observer_attach_solib_unloaded (bsd_uthread_solib_unloaded);
+  gdb_observers::inferior_created.attach (bsd_uthread_inferior_created);
+  gdb_observers::solib_loaded.attach (bsd_uthread_solib_loaded);
+  gdb_observers::solib_unloaded.attach (bsd_uthread_solib_unloaded);
 }
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 5d67ba4..7185519 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -385,12 +385,12 @@  _initialize_cli_interp (void)
   interp_factory_register (INTERP_CONSOLE, cli_interp_factory);
 
   /* If changing this, remember to update tui-interp.c as well.  */
-  observer_attach_normal_stop (cli_on_normal_stop);
-  observer_attach_end_stepping_range (cli_on_end_stepping_range);
-  observer_attach_signal_received (cli_on_signal_received);
-  observer_attach_signal_exited (cli_on_signal_exited);
-  observer_attach_exited (cli_on_exited);
-  observer_attach_no_history (cli_on_no_history);
-  observer_attach_sync_execution_done (cli_on_sync_execution_done);
-  observer_attach_command_error (cli_on_command_error);
+  gdb_observers::normal_stop.attach (cli_on_normal_stop);
+  gdb_observers::end_stepping_range.attach (cli_on_end_stepping_range);
+  gdb_observers::signal_received.attach (cli_on_signal_received);
+  gdb_observers::signal_exited.attach (cli_on_signal_exited);
+  gdb_observers::exited.attach (cli_on_exited);
+  gdb_observers::no_history.attach (cli_on_no_history);
+  gdb_observers::sync_execution_done.attach (cli_on_sync_execution_done);
+  gdb_observers::command_error.attach (cli_on_command_error);
 }
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index eb17158..988fd4c 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -519,20 +519,20 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	case var_filename:
 	case var_optional_filename:
 	case var_enum:
-	  observer_notify_command_param_changed (name, *(char **) c->var);
+	  gdb_observers::command_param_changed.notify (name, *(char **) c->var);
 	  break;
 	case var_boolean:
 	  {
 	    const char *opt = *(int *) c->var ? "on" : "off";
 
-	    observer_notify_command_param_changed (name, opt);
+	    gdb_observers::command_param_changed.notify (name, opt);
 	  }
 	  break;
 	case var_auto_boolean:
 	  {
 	    const char *s = auto_boolean_enums[*(enum auto_boolean *) c->var];
 
-	    observer_notify_command_param_changed (name, s);
+	    gdb_observers::command_param_changed.notify (name, s);
 	  }
 	  break;
 	case var_uinteger:
@@ -541,7 +541,7 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	    char s[64];
 
 	    xsnprintf (s, sizeof s, "%u", *(unsigned int *) c->var);
-	    observer_notify_command_param_changed (name, s);
+	    gdb_observers::command_param_changed.notify (name, s);
 	  }
 	  break;
 	case var_integer:
@@ -551,7 +551,7 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	    char s[64];
 
 	    xsnprintf (s, sizeof s, "%d", *(int *) c->var);
-	    observer_notify_command_param_changed (name, s);
+	    gdb_observers::command_param_changed.notify (name, s);
 	  }
 	  break;
 	}
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 64de931..2c97e21 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -421,7 +421,7 @@  write_memory_with_notification (CORE_ADDR memaddr, const bfd_byte *myaddr,
 				ssize_t len)
 {
   write_memory (memaddr, myaddr, len);
-  observer_notify_memory_changed (current_inferior (), memaddr, len, myaddr);
+  gdb_observers::memory_changed.notify (current_inferior (), memaddr, len, myaddr);
 }
 
 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 606fb85..ef16c71 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -429,5 +429,5 @@  _initialize_dummy_frame (void)
 	   _("Print the contents of the internal dummy-frame stack."),
 	   &maintenanceprintlist);
 
-  observer_attach_inferior_created (cleanup_dummy_frames);
+  gdb_observers::inferior_created.attach (cleanup_dummy_frames);
 }
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index f94a6fa..eb5efa3 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -382,7 +382,7 @@  start_event_loop (void)
 	     get around to resetting the prompt, which leaves readline
 	     in a messed-up state.  Reset it here.  */
 	  current_ui->prompt_state = PROMPT_NEEDED;
-	  observer_notify_command_error ();
+	  gdb_observers::command_error.notify ();
 	  /* This call looks bizarre, but it is required.  If the user
 	     entered a command that caused an error,
 	     after_char_processing_hook won't be called from
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 576eded..e20b363 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -422,7 +422,7 @@  top_level_prompt (void)
 
   /* Give observers a chance of changing the prompt.  E.g., the python
      `gdb.prompt_hook' is installed as an observer.  */
-  observer_notify_before_prompt (get_prompt ());
+  gdb_observers::before_prompt.notify (get_prompt ());
 
   prompt = get_prompt ();
 
diff --git a/gdb/exec.c b/gdb/exec.c
index d858e99..c32fb1e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -408,7 +408,7 @@  exec_file_attach (const char *filename, int from_tty)
   do_cleanups (cleanups);
 
   bfd_cache_close_all ();
-  observer_notify_executable_changed ();
+  gdb_observers::executable_changed.notify ();
 }
 
 /*  Process the first arg in ARGS as the new exec file.
diff --git a/gdb/extension.c b/gdb/extension.c
index c9f5664..f99445f 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -1066,5 +1066,5 @@  extern initialize_file_ftype _initialize_extension;
 void
 _initialize_extension (void)
 {
-  observer_attach_before_prompt (ext_lang_before_prompt);
+  gdb_observers::before_prompt.attach (ext_lang_before_prompt);
 }
diff --git a/gdb/frame.c b/gdb/frame.c
index d3f3056..50f057d 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2839,7 +2839,7 @@  _initialize_frame (void)
 
   frame_stash_create ();
 
-  observer_attach_target_changed (frame_observer_target_changed);
+  gdb_observers::target_changed.attach (frame_observer_target_changed);
 
   add_prefix_cmd ("backtrace", class_maintenance, set_backtrace_cmd, _("\
 Set backtrace specific variables.\n\
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 4d8ef18..ec01f30 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5298,7 +5298,7 @@  set_target_gdbarch (struct gdbarch *new_gdbarch)
   gdb_assert (new_gdbarch != NULL);
   gdb_assert (new_gdbarch->initialized_p);
   current_inferior ()->gdbarch = new_gdbarch;
-  observer_notify_architecture_changed (new_gdbarch);
+  gdb_observers::architecture_changed.notify (new_gdbarch);
   registers_changed ();
 }
 
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index baecf01..2da4868 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -1337,8 +1337,8 @@  gdbscm_initialize_breakpoints (void)
   scm_set_smob_free (breakpoint_smob_tag, bpscm_free_breakpoint_smob);
   scm_set_smob_print (breakpoint_smob_tag, bpscm_print_breakpoint_smob);
 
-  observer_attach_breakpoint_created (bpscm_breakpoint_created);
-  observer_attach_breakpoint_deleted (bpscm_breakpoint_deleted);
+  gdb_observers::breakpoint_created.attach (bpscm_breakpoint_created);
+  gdb_observers::breakpoint_deleted.attach (bpscm_breakpoint_deleted);
 
   gdbscm_define_integer_constants (breakpoint_integer_constants, 1);
   gdbscm_define_functions (breakpoint_functions, 1);
diff --git a/gdb/infcall.c b/gdb/infcall.c
index ab7426d..4dc1f1d 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -885,7 +885,7 @@  call_function_by_hand_dummy (struct value *function,
       target_values_type = values_type;
     }
 
-  observer_notify_inferior_call_pre (inferior_ptid, funaddr);
+  gdb_observers::inferior_call_pre.notify (inferior_ptid, funaddr);
 
   /* Determine the location of the breakpoint (and possibly other
      stuff) that the called function will return to.  The SPARC, for a
@@ -1150,7 +1150,7 @@  call_function_by_hand_dummy (struct value *function,
 
     e = run_inferior_call (sm, tp, real_pc);
 
-    observer_notify_inferior_call_post (call_thread_ptid, funaddr);
+    gdb_observers::inferior_call_post.notify (call_thread_ptid, funaddr);
 
     tp = find_thread_ptid (call_thread_ptid);
     if (tp != NULL)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 8e34b7e..4726db4 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -474,7 +474,7 @@  post_create_inferior (struct target_ops *target, int from_tty)
      if the now pushed target supports hardware watchpoints.  */
   breakpoint_re_set ();
 
-  observer_notify_inferior_created (target, from_tty);
+  gdb_observers::inferior_created.notify (target, from_tty);
 }
 
 /* Kill the inferior if already running.  This function is designed
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 47d91c7..14f61f5 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -152,7 +152,7 @@  add_inferior_silent (int pid)
 
   inferior_alloc_data (inf);
 
-  observer_notify_inferior_added (inf);
+  gdb_observers::inferior_added.notify (inf);
 
   if (pid != 0)
     inferior_appeared (inf, pid);
@@ -219,7 +219,7 @@  delete_inferior (struct inferior *todel)
   else
     inferior_list = inf->next;
 
-  observer_notify_inferior_removed (inf);
+  gdb_observers::inferior_removed.notify (inf);
 
   /* If this program space is rendered useless, remove it. */
   if (program_space_empty_p (inf->pspace))
@@ -249,7 +249,7 @@  exit_inferior_1 (struct inferior *inftoex, int silent)
 
   iterate_over_threads (delete_thread_of_inferior, &arg);
 
-  observer_notify_inferior_exit (inf);
+  gdb_observers::inferior_exit.notify (inf);
 
   inf->pid = 0;
   inf->fake_pid_p = 0;
@@ -312,7 +312,7 @@  inferior_appeared (struct inferior *inf, int pid)
   inf->has_exit_code = 0;
   inf->exit_code = 0;
 
-  observer_notify_inferior_appeared (inf);
+  gdb_observers::inferior_appeared.notify (inf);
 }
 
 void
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 5b55cec..527da5e 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -885,7 +885,7 @@  _initialize_inflow (void)
 #endif /* TIOCGPGRP */
 #endif /* sgtty */
 
-  observer_attach_inferior_exit (inflow_inferior_exit);
+  gdb_observers::inferior_exit.attach (inflow_inferior_exit);
 
   inflow_inferior_data
     = register_inferior_data_with_cleanup (NULL, inflow_inferior_data_cleanup);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2636a19..8d08ef8 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2902,7 +2902,7 @@  clear_proceed_status (int step)
       inferior->control.stop_soon = NO_STOP_QUIETLY;
     }
 
-  observer_notify_about_to_proceed ();
+  gdb_observers::about_to_proceed.notify ();
 }
 
 /* Returns true if TP is still stopped at a breakpoint that needs
@@ -3847,7 +3847,7 @@  check_curr_ui_sync_execution_done (void)
       && !gdb_in_secondary_prompt_p (ui))
     {
       target_terminal_ours ();
-      observer_notify_sync_execution_done ();
+      gdb_observers::sync_execution_done.notify ();
       ui_register_input_event_handler (ui);
     }
 }
@@ -5099,7 +5099,7 @@  handle_inferior_event_1 (struct execution_control_state *ecs)
 	  /* Support the --return-child-result option.  */
 	  return_child_result_value = ecs->ws.value.integer;
 
-	  observer_notify_exited (ecs->ws.value.integer);
+	  gdb_observers::exited.notify (ecs->ws.value.integer);
 	}
       else
 	{
@@ -5128,7 +5128,7 @@  handle_inferior_event_1 (struct execution_control_state *ecs)
 Cannot fill $_exitsignal with the correct signal number.\n"));
 	    }
 
-	  observer_notify_signal_exited (ecs->ws.value.sig);
+	  gdb_observers::signal_exited.notify (ecs->ws.value.sig);
 	}
 
       gdb_flush (gdb_stdout);
@@ -5406,7 +5406,7 @@  Cannot fill $_exitsignal with the correct signal number.\n"));
 
       delete_just_stopped_threads_single_step_breakpoints ();
       stop_pc = regcache_read_pc (get_thread_regcache (inferior_ptid));
-      observer_notify_no_history ();
+      gdb_observers::no_history.notify ();
       stop_waiting (ecs);
       return;
     }
@@ -6100,7 +6100,7 @@  handle_signal_stop (struct execution_control_state *ecs)
 	{
 	  /* The signal table tells us to print about this signal.  */
 	  target_terminal_ours_for_output ();
-	  observer_notify_signal_received (ecs->event_thread->suspend.stop_signal);
+	  gdb_observers::signal_received.notify (ecs->event_thread->suspend.stop_signal);
 	  target_terminal_inferior ();
 	}
 
@@ -8270,7 +8270,7 @@  normal_stop (void)
   update_thread_list ();
 
   if (last.kind == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
-    observer_notify_signal_received (inferior_thread ()->suspend.stop_signal);
+    gdb_observers::signal_received.notify (inferior_thread ()->suspend.stop_signal);
 
   /* As with the notification of thread events, we want to delay
      notifying the user that we've switched thread context until
@@ -8387,10 +8387,10 @@  normal_stop (void)
   /* Notify observers about the stop.  This is where the interpreters
      print the stop event.  */
   if (!ptid_equal (inferior_ptid, null_ptid))
-    observer_notify_normal_stop (inferior_thread ()->control.stop_bpstat,
+    gdb_observers::normal_stop.notify (inferior_thread ()->control.stop_bpstat,
 				 stop_print_frame);
   else
-    observer_notify_normal_stop (NULL, stop_print_frame);
+    gdb_observers::normal_stop.notify (NULL, stop_print_frame);
 
   annotate_stopped ();
 
@@ -9539,10 +9539,10 @@  enabled by default on some platforms."),
   inferior_ptid = null_ptid;
   target_last_wait_ptid = minus_one_ptid;
 
-  observer_attach_thread_ptid_changed (infrun_thread_ptid_changed);
-  observer_attach_thread_stop_requested (infrun_thread_stop_requested);
-  observer_attach_thread_exit (infrun_thread_thread_exit);
-  observer_attach_inferior_exit (infrun_inferior_exit);
+  gdb_observers::thread_ptid_changed.attach (infrun_thread_ptid_changed);
+  gdb_observers::thread_stop_requested.attach (infrun_thread_stop_requested);
+  gdb_observers::thread_exit.attach (infrun_thread_thread_exit);
+  gdb_observers::inferior_exit.attach (infrun_inferior_exit);
 
   /* Explicitly create without lookup, since that tries to create a
      value with a void typed value, and when we get here, gdbarch
diff --git a/gdb/jit.c b/gdb/jit.c
index 81a2c26..840c91e 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1519,9 +1519,9 @@  _initialize_jit (void)
 			     show_jit_debug,
 			     &setdebuglist, &showdebuglist);
 
-  observer_attach_inferior_created (jit_inferior_created);
-  observer_attach_inferior_exit (jit_inferior_exit_hook);
-  observer_attach_breakpoint_deleted (jit_breakpoint_deleted);
+  gdb_observers::inferior_created.attach (jit_inferior_created);
+  gdb_observers::inferior_exit.attach (jit_inferior_exit_hook);
+  gdb_observers::breakpoint_deleted.attach (jit_breakpoint_deleted);
 
   jit_objfile_data =
     register_objfile_data_with_cleanup (NULL, free_objfile_data);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 718dc1a..341644d 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -2545,8 +2545,8 @@  _initialize_linux_tdep (void)
   linux_inferior_data
     = register_inferior_data_with_cleanup (NULL, linux_inferior_data_cleanup);
   /* Observers used to invalidate the cache when needed.  */
-  observer_attach_inferior_exit (invalidate_linux_cache_inf);
-  observer_attach_inferior_appeared (invalidate_linux_cache_inf);
+  gdb_observers::inferior_exit.attach (invalidate_linux_cache_inf);
+  gdb_observers::inferior_appeared.attach (invalidate_linux_cache_inf);
 
   add_setshow_boolean_cmd ("use-coredump-filter", class_files,
 			   &use_coredump_filter, _("\
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 6ed3997..a8e4bf9 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -988,7 +988,7 @@  thread_db_new_objfile (struct objfile *objfile)
   if (objfile != NULL
       /* libpthread with separate debug info has its debug info file already
 	 loaded (and notified without successful thread_db initialization)
-	 the time observer_notify_new_objfile is called for the library itself.
+	 the time gdb_observers::new_objfile.notify is called for the library itself.
 	 Static executables have their separate debug info loaded already
 	 before the inferior has started.  */
       && objfile->separate_debug_objfile_backlink == NULL
@@ -1750,10 +1750,10 @@  Usage: info auto-load libthread-db"),
 	   auto_load_info_cmdlist_get ());
 
   /* Add ourselves to objfile event chain.  */
-  observer_attach_new_objfile (thread_db_new_objfile);
+  gdb_observers::new_objfile.attach (thread_db_new_objfile);
 
   /* Add ourselves to inferior_created event chain.
      This is needed to handle debugging statically linked programs where
      the new_objfile observer won't get called for libpthread.  */
-  observer_attach_inferior_created (thread_db_inferior_created);
+  gdb_observers::inferior_created.attach (thread_db_inferior_created);
 }
diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c
index 94fb953..cfbe7ed 100644
--- a/gdb/m68klinux-tdep.c
+++ b/gdb/m68klinux-tdep.c
@@ -431,5 +431,5 @@  _initialize_m68k_linux_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_LINUX,
 			  m68k_linux_init_abi);
-  observer_attach_inferior_created (m68k_linux_inferior_created);
+  gdb_observers::inferior_created.attach (m68k_linux_inferior_created);
 }
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 3d40629..967148b 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -76,7 +76,7 @@  setup_breakpoint_reporting (void)
 
   if (! mi_breakpoint_observers_installed)
     {
-      observer_attach_breakpoint_created (breakpoint_notify);
+      gdb_observers::breakpoint_created.attach (breakpoint_notify);
       mi_breakpoint_observers_installed = 1;
     }
 
@@ -403,7 +403,7 @@  mi_cmd_break_passcount (char *command, char **argv, int argc)
   if (t)
     {
       t->pass_count = p;
-      observer_notify_breakpoint_modified (&t->base);
+      gdb_observers::breakpoint_modified.notify (&t->base);
     }
   else
     {
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index e3c7dbd..42499ad 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1439,31 +1439,31 @@  _initialize_mi_interp (void)
   interp_factory_register (INTERP_MI3, mi_interp_factory);
   interp_factory_register (INTERP_MI, mi_interp_factory);
 
-  observer_attach_signal_received (mi_on_signal_received);
-  observer_attach_end_stepping_range (mi_on_end_stepping_range);
-  observer_attach_signal_exited (mi_on_signal_exited);
-  observer_attach_exited (mi_on_exited);
-  observer_attach_no_history (mi_on_no_history);
-  observer_attach_new_thread (mi_new_thread);
-  observer_attach_thread_exit (mi_thread_exit);
-  observer_attach_inferior_added (mi_inferior_added);
-  observer_attach_inferior_appeared (mi_inferior_appeared);
-  observer_attach_inferior_exit (mi_inferior_exit);
-  observer_attach_inferior_removed (mi_inferior_removed);
-  observer_attach_record_changed (mi_record_changed);
-  observer_attach_normal_stop (mi_on_normal_stop);
-  observer_attach_target_resumed (mi_on_resume);
-  observer_attach_solib_loaded (mi_solib_loaded);
-  observer_attach_solib_unloaded (mi_solib_unloaded);
-  observer_attach_about_to_proceed (mi_about_to_proceed);
-  observer_attach_traceframe_changed (mi_traceframe_changed);
-  observer_attach_tsv_created (mi_tsv_created);
-  observer_attach_tsv_deleted (mi_tsv_deleted);
-  observer_attach_tsv_modified (mi_tsv_modified);
-  observer_attach_breakpoint_created (mi_breakpoint_created);
-  observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
-  observer_attach_breakpoint_modified (mi_breakpoint_modified);
-  observer_attach_command_param_changed (mi_command_param_changed);
-  observer_attach_memory_changed (mi_memory_changed);
-  observer_attach_sync_execution_done (mi_on_sync_execution_done);
+  gdb_observers::signal_received.attach (mi_on_signal_received);
+  gdb_observers::end_stepping_range.attach (mi_on_end_stepping_range);
+  gdb_observers::signal_exited.attach (mi_on_signal_exited);
+  gdb_observers::exited.attach (mi_on_exited);
+  gdb_observers::no_history.attach (mi_on_no_history);
+  gdb_observers::new_thread.attach (mi_new_thread);
+  gdb_observers::thread_exit.attach (mi_thread_exit);
+  gdb_observers::inferior_added.attach (mi_inferior_added);
+  gdb_observers::inferior_appeared.attach (mi_inferior_appeared);
+  gdb_observers::inferior_exit.attach (mi_inferior_exit);
+  gdb_observers::inferior_removed.attach (mi_inferior_removed);
+  gdb_observers::record_changed.attach (mi_record_changed);
+  gdb_observers::normal_stop.attach (mi_on_normal_stop);
+  gdb_observers::target_resumed.attach (mi_on_resume);
+  gdb_observers::solib_loaded.attach (mi_solib_loaded);
+  gdb_observers::solib_unloaded.attach (mi_solib_unloaded);
+  gdb_observers::about_to_proceed.attach (mi_about_to_proceed);
+  gdb_observers::traceframe_changed.attach (mi_traceframe_changed);
+  gdb_observers::tsv_created.attach (mi_tsv_created);
+  gdb_observers::tsv_deleted.attach (mi_tsv_deleted);
+  gdb_observers::tsv_modified.attach (mi_tsv_modified);
+  gdb_observers::breakpoint_created.attach (mi_breakpoint_created);
+  gdb_observers::breakpoint_deleted.attach (mi_breakpoint_deleted);
+  gdb_observers::breakpoint_modified.attach (mi_breakpoint_modified);
+  gdb_observers::command_param_changed.attach (mi_command_param_changed);
+  gdb_observers::memory_changed.attach (mi_memory_changed);
+  gdb_observers::sync_execution_done.attach (mi_on_sync_execution_done);
 }
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 71f771d..7b28f5f 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -634,7 +634,7 @@  void
 free_objfile (struct objfile *objfile)
 {
   /* First notify observers that this objfile is about to be freed.  */
-  observer_notify_free_objfile (objfile);
+  gdb_observers::free_objfile.notify (objfile);
 
   /* Free all separate debug objfiles.  */
   free_objfile_separate_debug (objfile);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 84c14a1..c9a2592 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2516,7 +2516,7 @@  _initialize_ppc_linux_nat (void)
   t->to_read_description = ppc_linux_read_description;
   t->to_auxv_parse = ppc_linux_auxv_parse;
 
-  observer_attach_thread_exit (ppc_linux_thread_exit);
+  gdb_observers::thread_exit.attach (ppc_linux_thread_exit);
 
   /* Register the target.  */
   linux_nat_add_target (t);
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index ee158e3..d4dcdd6 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1852,9 +1852,9 @@  _initialize_ppc_linux_tdep (void)
                          ppc_linux_init_abi);
 
   /* Attach to observers to track __spe_current_active_context.  */
-  observer_attach_inferior_created (ppc_linux_spe_context_inferior_created);
-  observer_attach_solib_loaded (ppc_linux_spe_context_solib_loaded);
-  observer_attach_solib_unloaded (ppc_linux_spe_context_solib_unloaded);
+  gdb_observers::inferior_created.attach (ppc_linux_spe_context_inferior_created);
+  gdb_observers::solib_loaded.attach (ppc_linux_spe_context_solib_loaded);
+  gdb_observers::solib_unloaded.attach (ppc_linux_spe_context_solib_unloaded);
 
   /* Initialize the Linux target descriptions.  */
   initialize_tdesc_powerpc_32l ();
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d4a4b9e..8873143 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2761,7 +2761,7 @@  _initialize_printcmd (void)
 
   current_display_number = -1;
 
-  observer_attach_free_objfile (clear_dangling_display_expressions);
+  gdb_observers::free_objfile.attach (clear_dangling_display_expressions);
 
   add_info ("address", address_info,
 	    _("Describe where symbol SYM is stored."));
diff --git a/gdb/procfs.c b/gdb/procfs.c
index fab15ed..b503bea 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -5273,7 +5273,7 @@  extern void _initialize_procfs (void);
 void
 _initialize_procfs (void)
 {
-  observer_attach_inferior_created (procfs_inferior_created);
+  gdb_observers::inferior_created.attach (procfs_inferior_created);
 
   add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
 	   _("Give a trace of entries into the syscall."));
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 80f5d1f..260e137 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1008,9 +1008,9 @@  gdbpy_initialize_breakpoints (void)
 			      (PyObject *) &breakpoint_object_type) < 0)
     return -1;
 
-  observer_attach_breakpoint_created (gdbpy_breakpoint_created);
-  observer_attach_breakpoint_deleted (gdbpy_breakpoint_deleted);
-  observer_attach_breakpoint_modified (gdbpy_breakpoint_modified);
+  gdb_observers::breakpoint_created.attach (gdbpy_breakpoint_created);
+  gdb_observers::breakpoint_deleted.attach (gdbpy_breakpoint_deleted);
+  gdb_observers::breakpoint_modified.attach (gdbpy_breakpoint_modified);
 
   /* Add breakpoint types constants.  */
   for (i = 0; pybp_codes[i].name; ++i)
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 74d225b..cbeec70 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -427,8 +427,8 @@  gdbpy_initialize_finishbreakpoints (void)
 			      (PyObject *) &finish_breakpoint_object_type) < 0)
     return -1;
 
-  observer_attach_normal_stop (bpfinishpy_handle_stop);
-  observer_attach_inferior_exit (bpfinishpy_handle_exit);
+  gdb_observers::normal_stop.attach (bpfinishpy_handle_stop);
+  gdb_observers::inferior_exit.attach (bpfinishpy_handle_exit);
 
   return 0;
 }
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 8732b87..e5b47de 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -886,16 +886,16 @@  gdbpy_initialize_inferior (void)
   infpy_inf_data_key =
     register_inferior_data_with_cleanup (NULL, py_free_inferior);
 
-  observer_attach_new_thread (add_thread_object);
-  observer_attach_thread_exit (delete_thread_object);
-  observer_attach_normal_stop (python_on_normal_stop);
-  observer_attach_target_resumed (python_on_resume);
-  observer_attach_inferior_call_pre (python_on_inferior_call_pre);
-  observer_attach_inferior_call_post (python_on_inferior_call_post);
-  observer_attach_memory_changed (python_on_memory_change);
-  observer_attach_register_changed (python_on_register_change);
-  observer_attach_inferior_exit (python_inferior_exit);
-  observer_attach_new_objfile (python_new_objfile);
+  gdb_observers::new_thread.attach (add_thread_object);
+  gdb_observers::thread_exit.attach (delete_thread_object);
+  gdb_observers::normal_stop.attach (python_on_normal_stop);
+  gdb_observers::target_resumed.attach (python_on_resume);
+  gdb_observers::inferior_call_pre.attach (python_on_inferior_call_pre);
+  gdb_observers::inferior_call_post.attach (python_on_inferior_call_post);
+  gdb_observers::memory_changed.attach (python_on_memory_change);
+  gdb_observers::register_changed.attach (python_on_register_change);
+  gdb_observers::inferior_exit.attach (python_inferior_exit);
+  gdb_observers::new_objfile.attach (python_new_objfile);
 
   membuf_object_type.tp_new = PyType_GenericNew;
   if (PyType_Ready (&membuf_object_type) < 0)
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index cc685ae..c7a692b 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -670,7 +670,7 @@  gdbpy_initialize_unwind (void)
         &setdebuglist, &showdebuglist);
   pyuw_gdbarch_data
       = gdbarch_data_register_post_init (pyuw_gdbarch_data_init);
-  observer_attach_architecture_changed (pyuw_on_new_gdbarch);
+  gdb_observers::architecture_changed.attach (pyuw_on_new_gdbarch);
 
   if (PyType_Ready (&pending_frame_object_type) < 0)
     return -1;
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 3e0687d..6cd7cd4 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -432,7 +432,7 @@  _initialize_ravenscar (void)
 
   /* Notice when the inferior is created in order to push the
      ravenscar ops if needed.  */
-  observer_attach_inferior_created (ravenscar_inferior_created);
+  gdb_observers::inferior_created.attach (ravenscar_inferior_created);
 
   complete_target_initialization (&ravenscar_ops);
 
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 9876943..33906c9 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -176,7 +176,7 @@  record_btrace_auto_enable (void)
   DEBUG ("attach thread observer");
 
   record_btrace_thread_observer
-    = observer_attach_new_thread (record_btrace_enable_warn);
+    = gdb_observers::new_thread.attach (record_btrace_enable_warn);
 }
 
 /* Disable automatic tracing of new threads.  */
@@ -190,7 +190,7 @@  record_btrace_auto_disable (void)
 
   DEBUG ("detach thread observer");
 
-  observer_detach_new_thread (record_btrace_thread_observer);
+  gdb_observers::new_thread.detach (record_btrace_thread_observer);
   record_btrace_thread_observer = NULL;
 }
 
@@ -219,7 +219,7 @@  record_btrace_push_target (void)
   record_btrace_generating_corefile = 0;
 
   format = btrace_format_short_string (record_btrace_conf.format);
-  observer_notify_record_changed (current_inferior (), 1, "btrace", format);
+  gdb_observers::record_changed.notify (current_inferior (), 1, "btrace", format);
 }
 
 /* The to_open method of target record-btrace.  */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index e4dd55b..3b1ae04 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -869,7 +869,7 @@  record_full_open (const char *name, int from_tty)
 
   record_full_init_record_breakpoints ();
 
-  observer_notify_record_changed (current_inferior (),  1, "full", NULL);
+  gdb_observers::record_changed.notify (current_inferior (),  1, "full", NULL);
 }
 
 /* "to_close" target method.  Close the process record target.  */
diff --git a/gdb/record.c b/gdb/record.c
index 34ebd1b..153b75e 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -268,7 +268,7 @@  cmd_record_stop (char *args, int from_tty)
   printf_unfiltered (_("Process record is stopped and all execution "
 		       "logs are deleted.\n"));
 
-  observer_notify_record_changed (current_inferior (), 0, NULL, NULL);
+  gdb_observers::record_changed.notify (current_inferior (), 0, NULL, NULL);
 }
 
 /* The "set record" command.  */
diff --git a/gdb/regcache.c b/gdb/regcache.c
index a5c90a6..ed01ce0 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1533,8 +1533,8 @@  _initialize_regcache (void)
   regcache_descr_handle
     = gdbarch_data_register_post_init (init_regcache_descr);
 
-  observer_attach_target_changed (regcache_observer_target_changed);
-  observer_attach_thread_ptid_changed (regcache_thread_ptid_changed);
+  gdb_observers::target_changed.attach (regcache_observer_target_changed);
+  gdb_observers::thread_ptid_changed.attach (regcache_thread_ptid_changed);
 
   add_com ("flushregs", class_maintenance, reg_flush_command,
 	   _("Force gdb to flush its register cache (maintainer command)"));
diff --git a/gdb/remote.c b/gdb/remote.c
index af7508a..0118c1a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3835,9 +3835,9 @@  print_one_stopped_thread (struct thread_info *thread)
       enum gdb_signal sig = ws->value.sig;
 
       if (signal_print_state (sig))
-	observer_notify_signal_received (sig);
+	gdb_observers::signal_received.notify (sig);
     }
-  observer_notify_normal_stop (NULL, 1);
+  gdb_observers::normal_stop.notify (NULL, 1);
 }
 
 /* Process all initial stop replies the remote side sent in response
@@ -13537,10 +13537,10 @@  _initialize_remote (void)
   add_target (&extended_remote_ops);
 
   /* Hook into new objfile notification.  */
-  observer_attach_new_objfile (remote_new_objfile);
+  gdb_observers::new_objfile.attach (remote_new_objfile);
   /* We're no longer interested in notification events of an inferior
      when it exits.  */
-  observer_attach_inferior_exit (discard_pending_stop_replies);
+  gdb_observers::inferior_exit.attach (discard_pending_stop_replies);
 
 #if 0
   init_remote_threadtests ();
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 000d223..7c47805 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1282,7 +1282,7 @@  _initialize_sol_thread (void)
 	   _("Show info on Solaris user threads."), &maintenanceinfolist);
 
   /* Hook into new_objfile notification.  */
-  observer_attach_new_objfile (sol_thread_new_objfile);
+  gdb_observers::new_objfile.attach (sol_thread_new_objfile);
   return;
 
  die:
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 51ab93e..90cd282 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -834,7 +834,7 @@  _initialize_solib_aix (void)
 
   solib_aix_inferior_data_handle = register_inferior_data ();
 
-  observer_attach_normal_stop (solib_aix_normal_stop_observer);
+  gdb_observers::normal_stop.attach (solib_aix_normal_stop_observer);
 
   /* Debug this file's internals.  */
   add_setshow_boolean_cmd ("aix-solib", class_maintenance,
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index fa2977e..08a8354 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -551,7 +551,7 @@  extern initialize_file_ftype _initialize_spu_solib;
 void
 _initialize_spu_solib (void)
 {
-  observer_attach_solib_loaded (spu_solib_loaded);
+  gdb_observers::solib_loaded.attach (spu_solib_loaded);
   ocl_program_data_key = register_objfile_data ();
 }
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 2235505..734fe31 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -848,7 +848,7 @@  update_solib_list (int from_tty, struct target_ops *target)
 	{
 	  /* Notify any observer that the shared object has been
 	     unloaded before we remove it from GDB's tables.  */
-	  observer_notify_solib_unloaded (gdb);
+	  gdb_observers::solib_unloaded.notify (gdb);
 
 	  VEC_safe_push (char_ptr, current_program_space->deleted_solibs,
 			 xstrdup (gdb->so_name));
@@ -910,7 +910,7 @@  update_solib_list (int from_tty, struct target_ops *target)
 
 	  /* Notify any observer that the shared object has been
 	     loaded now that we've added it to GDB's tables.  */
-	  observer_notify_solib_loaded (i);
+	  gdb_observers::solib_loaded.notify (i);
 	}
 
       /* If a library was not found, issue an appropriate warning
@@ -1255,7 +1255,7 @@  clear_solib (void)
       struct so_list *so = so_list_head;
 
       so_list_head = so->next;
-      observer_notify_solib_unloaded (so);
+      gdb_observers::solib_unloaded.notify (so);
       remove_target_sections (so);
       free_so (so);
     }
@@ -1669,7 +1669,7 @@  _initialize_solib (void)
 {
   solib_data = gdbarch_data_register_pre_init (solib_init);
 
-  observer_attach_free_objfile (remove_user_added_objfile);
+  gdb_observers::free_objfile.attach (remove_user_added_objfile);
 
   add_com ("sharedlibrary", class_files, sharedlibrary_command,
 	   _("Load shared object library symbols for files matching REGEXP."));
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index d4da08e..145f76d 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -402,8 +402,8 @@  _initialize_spu_multiarch (void)
   complete_target_initialization (&spu_ops);
 
   /* Install observers to watch for SPU objects.  */
-  observer_attach_inferior_created (spu_multiarch_inferior_created);
-  observer_attach_solib_loaded (spu_multiarch_solib_loaded);
-  observer_attach_solib_unloaded (spu_multiarch_solib_unloaded);
+  gdb_observers::inferior_created.attach (spu_multiarch_inferior_created);
+  gdb_observers::solib_loaded.attach (spu_multiarch_solib_loaded);
+  gdb_observers::solib_unloaded.attach (spu_multiarch_solib_unloaded);
 }
 
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index f62e8e7..85ddbb2 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2817,14 +2817,14 @@  _initialize_spu_tdep (void)
   register_gdbarch_init (bfd_arch_spu, spu_gdbarch_init);
 
   /* Add ourselves to objfile event chain.  */
-  observer_attach_new_objfile (spu_overlay_new_objfile);
+  gdb_observers::new_objfile.attach (spu_overlay_new_objfile);
   spu_overlay_data = register_objfile_data ();
 
   /* Install spu stop-on-load handler.  */
-  observer_attach_new_objfile (spu_catch_start);
+  gdb_observers::new_objfile.attach (spu_catch_start);
 
   /* Add ourselves to normal_stop event chain.  */
-  observer_attach_normal_stop (spu_attach_normal_stop);
+  gdb_observers::normal_stop.attach (spu_attach_normal_stop);
 
   /* Add root prefix command for all "set spu"/"show spu" commands.  */
   add_prefix_cmd ("spu", no_class, set_spu_command,
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 79739a6..be8d959 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -250,5 +250,5 @@  _initialize_symfile_mem (void)
 
   /* Want to know of each new inferior so that its vsyscall info can
      be extracted.  */
-  observer_attach_inferior_created (add_vsyscall_page);
+  gdb_observers::inferior_created.attach (add_vsyscall_page);
 }
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7eb6cdc..368564b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1226,13 +1226,13 @@  symbol_file_add_with_addrs (bfd *abfd, const char *name, int add_flags,
 
   if (objfile->sf == NULL)
     {
-      observer_notify_new_objfile (objfile);
+      gdb_observers::new_objfile.notify (objfile);
       return objfile;	/* No symbols.  */
     }
 
   finish_new_objfile (objfile, add_flags);
 
-  observer_notify_new_objfile (objfile);
+  gdb_observers::new_objfile.notify (objfile);
 
   bfd_cache_close_all ();
   return (objfile);
@@ -2691,14 +2691,14 @@  reread_symbols (void)
       clear_symtab_users (0);
 
       /* clear_objfile_data for each objfile was called before freeing it and
-	 observer_notify_new_objfile (NULL) has been called by
+	 gdb_observers::new_objfile.notify (NULL) has been called by
 	 clear_symtab_users above.  Notify the new files now.  */
       for (ix = 0; VEC_iterate (objfilep, new_objfiles, ix, objfile); ix++)
-	observer_notify_new_objfile (objfile);
+	gdb_observers::new_objfile.notify (objfile);
 
       /* At least one objfile has changed, so we can consider that
          the executable we're debugging has changed too.  */
-      observer_notify_executable_changed ();
+      gdb_observers::executable_changed.notify ();
     }
 
   do_cleanups (all_cleanups);
@@ -2953,7 +2953,7 @@  clear_symtab_users (int add_flags)
   clear_displays ();
   clear_last_displayed_sal ();
   clear_pc_function_cache ();
-  observer_notify_new_objfile (NULL);
+  gdb_observers::new_objfile.notify (NULL);
 
   /* Clear globals which might have pointed into a removed objfile.
      FIXME: It's not clear which of these are supposed to persist
@@ -3904,7 +3904,7 @@  _initialize_symfile (void)
 {
   struct cmd_list_element *c;
 
-  observer_attach_free_objfile (symfile_free_objfile);
+  gdb_observers::free_objfile.attach (symfile_free_objfile);
 
   c = add_cmd ("symbol-file", class_files, symbol_file_command, _("\
 Load symbol table from executable file FILE.\n\
diff --git a/gdb/symtab.c b/gdb/symtab.c
index e776a0c..5840c7e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6342,7 +6342,7 @@  If zero then the symbol cache is disabled."),
 	   _("Flush the symbol cache for each program space."),
 	   &maintenancelist);
 
-  observer_attach_executable_changed (symtab_observer_executable_changed);
-  observer_attach_new_objfile (symtab_new_objfile_observer);
-  observer_attach_free_objfile (symtab_free_objfile_observer);
+  gdb_observers::executable_changed.attach (symtab_observer_executable_changed);
+  gdb_observers::new_objfile.attach (symtab_new_objfile_observer);
+  gdb_observers::free_objfile.attach (symtab_free_objfile_observer);
 }
diff --git a/gdb/thread.c b/gdb/thread.c
index a66a2b5..d805578 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -300,7 +300,7 @@  add_thread_silent (ptid_t ptid)
 	  tp->state = THREAD_STOPPED;
 	  switch_to_thread (ptid);
 
-	  observer_notify_new_thread (tp);
+	  gdb_observers::new_thread.notify (tp);
 
 	  /* All done.  */
 	  return tp;
@@ -311,7 +311,7 @@  add_thread_silent (ptid_t ptid)
     }
 
   tp = new_thread (inf, ptid);
-  observer_notify_new_thread (tp);
+  gdb_observers::new_thread.notify (tp);
 
   return tp;
 }
@@ -444,7 +444,7 @@  delete_thread_1 (ptid_t ptid, int silent)
     {
       if (tp->state != THREAD_EXITED)
 	{
-	  observer_notify_thread_exit (tp, silent);
+	  gdb_observers::thread_exit.notify (tp, silent);
 
 	  /* Tag it as exited.  */
 	  tp->state = THREAD_EXITED;
@@ -459,7 +459,7 @@  delete_thread_1 (ptid_t ptid, int silent)
 
   /* Notify thread exit, but only if we haven't already.  */
   if (tp->state != THREAD_EXITED)
-    observer_notify_thread_exit (tp, silent);
+    gdb_observers::thread_exit.notify (tp, silent);
 
   /* Tag it as exited.  */
   tp->state = THREAD_EXITED;
@@ -890,7 +890,7 @@  thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
   tp = find_thread_ptid (old_ptid);
   tp->ptid = new_ptid;
 
-  observer_notify_thread_ptid_changed (old_ptid, new_ptid);
+  gdb_observers::thread_ptid_changed.notify (old_ptid, new_ptid);
 }
 
 /* See gdbthread.h.  */
@@ -970,7 +970,7 @@  set_running (ptid_t ptid, int running)
 	any_started = 1;
     }
   if (any_started)
-    observer_notify_target_resumed (ptid);
+    gdb_observers::target_resumed.notify (ptid);
 }
 
 static int
@@ -1069,7 +1069,7 @@  set_stop_requested (ptid_t ptid, int stop)
   /* Call the stop requested observer so other components of GDB can
      react to this request.  */
   if (stop)
-    observer_notify_thread_stop_requested (ptid);
+    gdb_observers::thread_stop_requested.notify (ptid);
 }
 
 void
@@ -1106,7 +1106,7 @@  finish_thread_state (ptid_t ptid)
     }
 
   if (any_started)
-    observer_notify_target_resumed (ptid);
+    gdb_observers::target_resumed.notify (ptid);
 }
 
 void
@@ -2238,5 +2238,5 @@  Show printing of thread events (such as thread start and exit)."), NULL,
   create_internalvar_type_lazy ("_thread", &thread_funcs, NULL);
   create_internalvar_type_lazy ("_gthread", &gthread_funcs, NULL);
 
-  observer_attach_thread_ptid_changed (restore_current_thread_ptid_changed);
+  gdb_observers::thread_ptid_changed.attach (restore_current_thread_ptid_changed);
 }
diff --git a/gdb/top.c b/gdb/top.c
index 3cfa113..b49d6c2 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1998,7 +1998,7 @@  static void
 set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
 {
   set_gdb_data_directory (staged_gdb_datadir);
-  observer_notify_gdb_datadir_changed ();
+  gdb_observers::gdb_datadir_changed.notify ();
 }
 
 /* "show" command for the gdb_datadir configuration variable.  */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c89c77e..6b1b2e2 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -349,7 +349,7 @@  delete_trace_state_variable (const char *name)
   for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
     if (strcmp (name, tsv->name) == 0)
       {
-	observer_notify_tsv_deleted (tsv);
+	gdb_observers::tsv_deleted.notify (tsv);
 
 	xfree ((void *)tsv->name);
 	VEC_unordered_remove (tsv_s, tvariables, ix);
@@ -426,7 +426,7 @@  trace_variable_command (char *args, int from_tty)
       if (tsv->initial_value != initval)
 	{
 	  tsv->initial_value = initval;
-	  observer_notify_tsv_modified (tsv);
+	  gdb_observers::tsv_modified.notify (tsv);
 	}
       printf_filtered (_("Trace state variable $%s "
 			 "now has initial value %s.\n"),
@@ -439,7 +439,7 @@  trace_variable_command (char *args, int from_tty)
   tsv = create_trace_state_variable (name);
   tsv->initial_value = initval;
 
-  observer_notify_tsv_created (tsv);
+  gdb_observers::tsv_created.notify (tsv);
 
   printf_filtered (_("Trace state variable $%s "
 		     "created, with initial value %s.\n"),
@@ -460,7 +460,7 @@  delete_trace_variable_command (char *args, int from_tty)
       if (query (_("Delete all trace state variables? ")))
 	VEC_free (tsv_s, tvariables);
       dont_repeat ();
-      observer_notify_tsv_deleted (NULL);
+      gdb_observers::tsv_deleted.notify (NULL);
       return;
     }
 
@@ -1861,7 +1861,7 @@  start_tracing (char *notes)
 						 loc->gdbarch);
 
       if (bp_location_downloaded)
-	observer_notify_breakpoint_modified (b);
+	gdb_observers::breakpoint_modified.notify (b);
     }
   VEC_free (breakpoint_p, tp_vec);
 
@@ -2379,7 +2379,7 @@  tfind_1 (enum trace_find_type type, int num,
   set_tracepoint_num (tp ? tp->base.number : target_tracept);
 
   if (target_frameno != get_traceframe_number ())
-    observer_notify_traceframe_changed (target_frameno, tracepoint_number);
+    gdb_observers::traceframe_changed.notify (target_frameno, tracepoint_number);
 
   set_current_traceframe (target_frameno);
 
@@ -3448,7 +3448,7 @@  merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
   /* Notify 'breakpoint-modified' observer that at least one of B's
      locations was changed.  */
   for (ix = 0; VEC_iterate (breakpoint_p, modified_tp, ix, b); ix++)
-    observer_notify_breakpoint_modified (b);
+    gdb_observers::breakpoint_modified.notify (b);
 
   VEC_free (breakpoint_p, modified_tp);
   free_uploaded_tps (uploaded_tps);
@@ -3501,7 +3501,7 @@  create_tsv_from_upload (struct uploaded_tsv *utsv)
   tsv->initial_value = utsv->initial_value;
   tsv->builtin = utsv->builtin;
 
-  observer_notify_tsv_created (tsv);
+  gdb_observers::tsv_created.notify (tsv);
 
   do_cleanups (old_chain);
 
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 8ca254d..899b767 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -235,19 +235,19 @@  tui_install_hooks (void)
 
   /* Install the event hooks.  */
   tui_bp_created_observer
-    = observer_attach_breakpoint_created (tui_event_create_breakpoint);
+    = gdb_observers::breakpoint_created.attach (tui_event_create_breakpoint);
   tui_bp_deleted_observer
-    = observer_attach_breakpoint_deleted (tui_event_delete_breakpoint);
+    = gdb_observers::breakpoint_deleted.attach (tui_event_delete_breakpoint);
   tui_bp_modified_observer
-    = observer_attach_breakpoint_modified (tui_event_modify_breakpoint);
+    = gdb_observers::breakpoint_modified.attach (tui_event_modify_breakpoint);
   tui_inferior_exit_observer
-    = observer_attach_inferior_exit (tui_inferior_exit);
+    = gdb_observers::inferior_exit.attach (tui_inferior_exit);
   tui_before_prompt_observer
-    = observer_attach_before_prompt (tui_before_prompt);
+    = gdb_observers::before_prompt.attach (tui_before_prompt);
   tui_normal_stop_observer
-    = observer_attach_normal_stop (tui_normal_stop);
+    = gdb_observers::normal_stop.attach (tui_normal_stop);
   tui_register_changed_observer
-    = observer_attach_register_changed (tui_register_changed);
+    = gdb_observers::register_changed.attach (tui_register_changed);
 }
 
 /* Remove the TUI specific hooks.  */
@@ -257,19 +257,19 @@  tui_remove_hooks (void)
   deprecated_print_frame_info_listing_hook = 0;
   deprecated_query_hook = 0;
   /* Remove our observers.  */
-  observer_detach_breakpoint_created (tui_bp_created_observer);
+  gdb_observers::breakpoint_created.detach (tui_bp_created_observer);
   tui_bp_created_observer = NULL;
-  observer_detach_breakpoint_deleted (tui_bp_deleted_observer);
+  gdb_observers::breakpoint_deleted.detach (tui_bp_deleted_observer);
   tui_bp_deleted_observer = NULL;
-  observer_detach_breakpoint_modified (tui_bp_modified_observer);
+  gdb_observers::breakpoint_modified.detach (tui_bp_modified_observer);
   tui_bp_modified_observer = NULL;
-  observer_detach_inferior_exit (tui_inferior_exit_observer);
+  gdb_observers::inferior_exit.detach (tui_inferior_exit_observer);
   tui_inferior_exit_observer = NULL;
-  observer_detach_before_prompt (tui_before_prompt_observer);
+  gdb_observers::before_prompt.detach (tui_before_prompt_observer);
   tui_before_prompt_observer = NULL;
-  observer_detach_normal_stop (tui_normal_stop_observer);
+  gdb_observers::normal_stop.detach (tui_normal_stop_observer);
   tui_normal_stop_observer = NULL;
-  observer_detach_register_changed (tui_register_changed_observer);
+  gdb_observers::register_changed.detach (tui_register_changed_observer);
   tui_register_changed_observer = NULL;
 }
 
@@ -279,5 +279,5 @@  void
 _initialize_tui_hooks (void)
 {
   /* Install the permanent hooks.  */
-  observer_attach_new_objfile (tui_new_objfile_hook);
+  gdb_observers::new_objfile.attach (tui_new_objfile_hook);
 }
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 3856382..ed33c1b 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -315,12 +315,12 @@  _initialize_tui_interp (void)
     }
 
   /* If changing this, remember to update cli-interp.c as well.  */
-  observer_attach_normal_stop (tui_on_normal_stop);
-  observer_attach_signal_received (tui_on_signal_received);
-  observer_attach_end_stepping_range (tui_on_end_stepping_range);
-  observer_attach_signal_exited (tui_on_signal_exited);
-  observer_attach_exited (tui_on_exited);
-  observer_attach_no_history (tui_on_no_history);
-  observer_attach_sync_execution_done (tui_on_sync_execution_done);
-  observer_attach_command_error (tui_on_command_error);
+  gdb_observers::normal_stop.attach (tui_on_normal_stop);
+  gdb_observers::signal_received.attach (tui_on_signal_received);
+  gdb_observers::end_stepping_range.attach (tui_on_end_stepping_range);
+  gdb_observers::signal_exited.attach (tui_on_signal_exited);
+  gdb_observers::exited.attach (tui_on_exited);
+  gdb_observers::no_history.attach (tui_on_no_history);
+  gdb_observers::sync_execution_done.attach (tui_on_sync_execution_done);
+  gdb_observers::command_error.attach (tui_on_command_error);
 }
diff --git a/gdb/valops.c b/gdb/valops.c
index 40392e8..5ecadba 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1178,7 +1178,7 @@  value_assign (struct value *toval, struct value *fromval)
 	      }
 	  }
 
-	observer_notify_register_changed (frame, value_reg);
+	gdb_observers::register_changed.notify (frame, value_reg);
 	break;
       }
 
@@ -1209,7 +1209,7 @@  value_assign (struct value *toval, struct value *fromval)
     case lval_register:
     case lval_computed:
 
-      observer_notify_target_changed (&current_target);
+      gdb_observers::target_changed.notify (&current_target);
 
       /* Having destroyed the frame cache, restore the selected
 	 frame.  */