/* Inferior process information for the remote server for GDB.
- Copyright (C) 2002, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2007, 2008 Free Software Foundation, Inc.
Contributed by MontaVista Software.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
}
}
-/* When debugging a single-threaded program, the threads list (such as
- it is) is indexed by PID. When debugging a multi-threaded program,
- we index by TID. This ugly routine replaces the
- first-debugged-thread's PID with its TID. */
-
-void
-change_inferior_id (struct inferior_list *list,
- unsigned long new_id)
-{
- if (list->head != list->tail)
- error ("tried to change thread ID after multiple threads are created");
-
- list->head->id = new_id;
-}
-
void
remove_inferior (struct inferior_list *list,
struct inferior_list_entry *entry)
clear_list (&all_threads);
clear_list (&all_dlls);
+
+ current_inferior = NULL;
+}
+
+/* Two utility functions for a truly degenerate inferior_list: a simple
+ PID listing. */
+
+void
+add_pid_to_list (struct inferior_list *list, unsigned long pid)
+{
+ struct inferior_list_entry *new_entry;
+
+ new_entry = malloc (sizeof (struct inferior_list_entry));
+ new_entry->id = pid;
+ add_inferior_to_list (list, new_entry);
+}
+
+int
+pull_pid_from_list (struct inferior_list *list, unsigned long pid)
+{
+ struct inferior_list_entry *new_entry;
+
+ new_entry = find_inferior_id (list, pid);
+ if (new_entry == NULL)
+ return 0;
+ else
+ {
+ remove_inferior (list, new_entry);
+ free (new_entry);
+ return 1;
+ }
}