/* Multi-process control for GDB, the GNU debugger.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
This file is part of GDB.
inf->next = inferior_list;
inferior_list = inf;
+ observer_notify_new_inferior (pid);
+
return inf;
}
{
struct inferior *inf = add_inferior_silent (pid);
- observer_notify_new_inferior (pid);
-
if (print_inferior_events)
printf_unfiltered (_("[New inferior %d]\n"), pid);
if (!inf)
return;
- if (infprev)
- infprev->next = inf->next;
- else
- inferior_list = inf->next;
-
- free_inferior (inf);
-
arg.pid = pid;
arg.silent = silent;
iterate_over_threads (delete_thread_of_inferior, &arg);
+ /* Notify the observers before removing the inferior from the list,
+ so that the observers have a change to look it up. */
observer_notify_inferior_exit (pid);
+
+ if (infprev)
+ infprev->next = inf->next;
+ else
+ inferior_list = inf->next;
+
+ free_inferior (inf);
}
void