Mon Jul 14 18:02:53 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
authorMichael Snyder <msnyder@vmware.com>
Tue, 15 Jul 1997 01:05:10 +0000 (01:05 +0000)
committerMichael Snyder <msnyder@vmware.com>
Tue, 15 Jul 1997 01:05:10 +0000 (01:05 +0000)
        * procfs.c (wait_fd): Handle an fd that has "hung up" or
        otherwise terminated (Solaris threads).

gdb/ChangeLog
gdb/procfs.c

index b4344ab02c9bad12cbbce7bbc40defee105d7c2f..1552bbc6b07b2f749c67921504f9b0725375209d 100644 (file)
@@ -1,3 +1,8 @@
+Mon Jul 14 18:02:53 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
+
+       * procfs.c (wait_fd): Handle an fd that has "hung up" or 
+       otherwise terminated (Solaris threads).
+
 start-sanitize-gdbtk
 Thu Jul 10 00:02:41 1997  Martin M. Hunt  <hunt@cygnus.com>
 
index aceaff71f42722e55b87721d0aa5277ba74d5842..e8215a523be5556af98bfadf8d85d14708db9e45 100644 (file)
@@ -840,7 +840,7 @@ procfs_write_pckill (pi)
 static struct procinfo *
 wait_fd ()
 {
-  struct procinfo *pi;
+  struct procinfo *pi, *next_pi;
 #ifndef LOSING_POLL
   int num_fds;
   int i;
@@ -850,6 +850,7 @@ wait_fd ()
                           attached process. */
   set_sigio_trap ();
 
+ wait_again:
 #ifndef LOSING_POLL
   while (1)
     {
@@ -891,20 +892,24 @@ wait_fd ()
       if (0 == (poll_list[i].revents & 
                (POLLWRNORM | POLLPRI | POLLERR | POLLHUP | POLLNVAL)))
        continue;
-      for (pi = procinfo_list; pi; pi = pi->next)
+      for (pi = procinfo_list; pi; pi = next_pi)
        {
+         next_pi = pi->next;
          if (poll_list[i].fd == pi->ctl_fd)
            {
-             if (!procfs_read_status(pi))
-               {
-                 /* The LWP has apparently terminated.  */
+             num_fds--;
+             if ((poll_list[i].revents & POLLHUP) != 0 ||
+                 !procfs_read_status(pi))
+               { /* The LWP has apparently terminated.  */
                  if (info_verbose)
-                   printf_filtered ("LWP %d doesn't respond.\n", 
+                   printf_filtered ("LWP %d exited.\n", 
                                     (pi->pid >> 16) & 0xffff);
-                 /* could call close_proc_file here, but I'm afraid to... */
+                 close_proc_file (pi);
+                 if (num_fds != 0)
+                   continue;           /* already another event to process */
+                 else
+                   goto wait_again;    /* wait for another event */
                }
-
-             num_fds--;
              pi->had_event = 1;
              break;
            }
@@ -3398,7 +3403,7 @@ procfs_wait (pid, ourstatus)
        default:
          error ("PIOCWSTOP, unknown why %d, what %d", why, what);
        }
-/* Stop all the other threads when any of them stops.  */
+      /* Stop all the other threads when any of them stops.  */
 
       {
        struct procinfo *procinfo, *next_pi;
This page took 0.027434 seconds and 4 git commands to generate.