/* Multi-process control for GDB, the GNU debugger.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbthread.h"
#include "ui-out.h"
#include "observer.h"
-#include "gdbthread.h"
#include "gdbcore.h"
#include "symfile.h"
#include "environ.h"
inf->vfork_child = NULL;
}
- inf->has_exit_code = 0;
- inf->exit_code = 0;
inf->pending_detach = 0;
}
inferior_appeared (struct inferior *inf, int pid)
{
inf->pid = pid;
+ inf->has_exit_code = 0;
+ inf->exit_code = 0;
observer_notify_inferior_appeared (inf);
}
return NULL;
}
-/* Find an inferior bound to PSPACE. */
+/* See inferior.h */
+
+struct inferior *
+find_inferior_ptid (ptid_t ptid)
+{
+ return find_inferior_pid (ptid_get_pid (ptid));
+}
+
+/* See inferior.h. */
struct inferior *
find_inferior_for_program_space (struct program_space *pspace)
{
- struct inferior *inf;
+ struct inferior *inf = current_inferior ();
+
+ if (inf->pspace == pspace)
+ return inf;
for (inf = inferior_list; inf != NULL; inf = inf->next)
{
return inf != NULL;
}
-/* Prune away automatically added program spaces that aren't required
- anymore. */
+/* Prune away any unused inferiors, and then prune away no longer used
+ program spaces. */
void
prune_inferiors (void)
delete_inferior_1 (inf, 1);
}
+
+ prune_program_spaces ();
}
struct inferior *