Remove cleanup from old_renaming_is_invisible
[deliverable/binutils-gdb.git] / gdb / inferior.c
index 880f25df0eaabbf470866402b6d8c59de5ff983b..d7122fcfad8e4628123799914f62157cccfbae7d 100644 (file)
@@ -26,7 +26,7 @@
 #include "gdbcmd.h"
 #include "gdbthread.h"
 #include "ui-out.h"
-#include "observer.h"
+#include "observable.h"
 #include "gdbcore.h"
 #include "symfile.h"
 #include "environ.h"
@@ -45,9 +45,8 @@ DEFINE_REGISTRY (inferior, REGISTRY_ACCESS_FIELD)
 struct inferior *inferior_list = NULL;
 static int highest_inferior_num;
 
-/* Print notices on inferior events (attach, detach, etc.), set with
-   `set print inferior-events'.  */
-static int print_inferior_events = 0;
+/* See inferior.h.  */
+int print_inferior_events = 1;
 
 /* The Current Inferior.  This is a strong reference.  I.e., whenever
    an inferior is the current inferior, its refcount is
@@ -109,7 +108,7 @@ add_inferior_silent (int pid)
       last->next = inf;
     }
 
-  observer_notify_inferior_added (inf);
+  gdb::observers::inferior_added.notify (inf);
 
   if (pid != 0)
     inferior_appeared (inf, pid);
@@ -123,7 +122,9 @@ add_inferior (int pid)
   struct inferior *inf = add_inferior_silent (pid);
 
   if (print_inferior_events)
-    printf_unfiltered (_("[New inferior %d]\n"), pid);
+    printf_unfiltered (_("[New inferior %d (%s)]\n"),
+                      inf->num,
+                      target_pid_to_str (pid_to_ptid (pid)));
 
   return inf;
 }
@@ -176,7 +177,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))
@@ -206,7 +207,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;
@@ -234,9 +235,6 @@ exit_inferior (int pid)
   struct inferior *inf = find_inferior_pid (pid);
 
   exit_inferior_1 (inf, 0);
-
-  if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d exited]\n"), pid);
 }
 
 void
@@ -266,7 +264,9 @@ detach_inferior (inferior *inf)
   exit_inferior_1 (inf, 0);
 
   if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d detached]\n"), pid);
+    printf_unfiltered (_("[Inferior %d (%s) detached]\n"),
+                      inf->num,
+                      target_pid_to_str (pid_to_ptid (pid)));
 }
 
 /* See inferior.h.  */
@@ -284,7 +284,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
@@ -713,7 +713,7 @@ inferior_command (const char *args, int from_tty)
          switch_to_thread (tp->ptid);
        }
 
-      observer_notify_user_selected_context_changed
+      gdb::observers::user_selected_context_changed.notify
        (USER_SELECTED_INFERIOR
         | USER_SELECTED_THREAD
         | USER_SELECTED_FRAME);
@@ -724,7 +724,8 @@ inferior_command (const char *args, int from_tty)
       switch_to_thread (null_ptid);
       set_current_program_space (inf->pspace);
 
-      observer_notify_user_selected_context_changed (USER_SELECTED_INFERIOR);
+      gdb::observers::user_selected_context_changed.notify
+       (USER_SELECTED_INFERIOR);
     }
 }
 
@@ -784,7 +785,7 @@ add_inferior_with_spaces (void)
      doesn't really return a new address space; otherwise, it
      really does.  */
   aspace = maybe_new_address_space ();
-  pspace = add_program_space (aspace);
+  pspace = new program_space (aspace);
   inf = add_inferior (0);
   inf->pspace = pspace;
   inf->aspace = pspace->aspace;
@@ -928,7 +929,7 @@ clone_inferior_command (const char *args, int from_tty)
         doesn't really return a new address space; otherwise, it
         really does.  */
       aspace = maybe_new_address_space ();
-      pspace = add_program_space (aspace);
+      pspace = new program_space (aspace);
       inf = add_inferior (0);
       inf->pspace = pspace;
       inf->aspace = pspace->aspace;
@@ -988,7 +989,7 @@ initialize_inferiors (void)
      can only allocate an inferior when all those modules have done
      that.  Do this after initialize_progspace, due to the
      current_program_space reference.  */
-  current_inferior_ = add_inferior (0);
+  current_inferior_ = add_inferior_silent (0);
   current_inferior_->incref ();
   current_inferior_->pspace = current_program_space;
   current_inferior_->aspace = current_program_space->aspace;
This page took 0.026116 seconds and 4 git commands to generate.