2006-03-09 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Fri, 10 Mar 2006 20:15:42 +0000 (20:15 +0000)
committerMichael Snyder <msnyder@vmware.com>
Fri, 10 Mar 2006 20:15:42 +0000 (20:15 +0000)
* linux-nat.c (kill_inferior): Just call target_mourn_inferior
instead of getting tricky for the multi-fork case.
* linux-fork.c (linux_fork_killall): Call PT_KILL and waitpid
for each fork, and then use init_fork_list to delete them.

gdb/ChangeLog
gdb/linux-fork.c
gdb/linux-nat.c

index 6671148d8e40a4ec95b4bf64d957ebe634dafb4a..4e215bc9b466ede49beb612ee6740cd0e150499f 100644 (file)
@@ -1,6 +1,9 @@
-2006-03-09  Joel Brobecker  <brobecker@adacore.com>
+2006-03-09  Michael Snyder  <msnyder@redhat.com>
 
-       * MAINTAINERS (Patch Champions): Remove self.
+       * linux-nat.c (kill_inferior): Just call target_mourn_inferior
+       instead of getting tricky for the multi-fork case.
+       * linux-fork.c (linux_fork_killall): Call PT_KILL and waitpid
+       for each fork, and then use init_fork_list to delete them.
 
 2006-03-08  Alexandre Oliva  <aoliva@redhat.com>
 
index 768c7da59574aa2ba90bb54be176a3c40dee00d6..f024490d1f96dd701f266d1c1020cb7f07407d34 100644 (file)
@@ -72,8 +72,7 @@ add_fork (pid_t pid)
 {
   struct fork_info *fp;
 
-  if (fork_list == NULL &&
-      pid != PIDGET (inferior_ptid))
+  if (fork_list == NULL && pid != PIDGET (inferior_ptid))
     {
       /* Special case -- if this is the first fork in the list
         (the list is hitherto empty), and if this new fork is
@@ -322,17 +321,22 @@ linux_fork_killall (void)
      status for it) -- however any process may be a child
      or a parent, so may get a SIGCHLD from a previously
      killed child.  Wait them all out.  */
+  struct fork_info *fp;
   pid_t pid, ret;
   int status;
 
-  do {
-    pid = PIDGET (fork_list->ptid);
-    do {
-      ptrace (PT_KILL, pid, 0, 0);
-      ret = waitpid (pid, &status, 0);
-    } while (ret == pid && WIFSTOPPED (status));
-    delete_fork (fork_list->ptid);
-  } while (fork_list != NULL);
+  for (fp = fork_list; fp; fp = fp->next)
+    {
+      pid = PIDGET (fp->ptid);
+      do {
+       ptrace (PT_KILL, pid, 0, 0);
+       ret = waitpid (pid, &status, 0);
+       /* We might get a SIGCHLD instead of an exit status.  This is
+        aggravated by the first kill above - a child has just
+        died.  MVS comment cut-and-pasted from linux-nat.  */
+      } while (ret == pid && WIFSTOPPED (status));
+    }
+  init_fork_list ();   /* Clear list, prepare to start fresh.  */
 }
 
 /* The current inferior_ptid has exited, but there are other viable
index 0710ac718acbbadee3883b8999b6f849cd733cbe..2ba5d7d1647426fbb61097f96f92955bbf9e44f1 100644 (file)
@@ -616,8 +616,6 @@ kill_inferior (void)
   if (forks_exist_p ())
     {
       linux_fork_killall ();
-      pop_target ();
-      generic_mourn_inferior ();
     }
   else
     {
@@ -646,8 +644,8 @@ kill_inferior (void)
          ptrace (PT_KILL, pid, 0, 0);
          ret = wait (&status);
        }
-      target_mourn_inferior ();
     }
+  target_mourn_inferior ();
 }
 
 /* On GNU/Linux there are no real LWP's.  The closest thing to LWP's
This page took 0.028381 seconds and 4 git commands to generate.