* gdb.texinfo (Omissions from Ada): Remove incorrect documentation
[deliverable/binutils-gdb.git] / gdb / gdbserver / inferiors.c
index c73bf452e0aeadec95dbaf8cf33483241f591be8..f35cfa06b17cca5ae5e00de2f4b80d9a6dd54c9b 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -7,7 +7,7 @@
 
    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,
@@ -16,9 +16,7 @@
    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>
 
@@ -67,21 +65,6 @@ for_each_inferior (struct inferior_list *list,
     }
 }
 
-/* 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)
@@ -319,4 +302,35 @@ clear_inferiors (void)
 
   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;
+    }
 }
This page took 0.02454 seconds and 4 git commands to generate.