2012-02-27 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-low.c
index f2887e65413f368c37aa22512968f88b5f175114..8f57ee3407cf7cb6698710bb0767b92a3f1d5d91 100644 (file)
@@ -598,37 +598,6 @@ linux_create_inferior (char *program, char **allargs)
   return pid;
 }
 
-/* Detect `T (stopped)' in `/proc/PID/status'.
-   Other states including `T (tracing stop)' are reported as false.  */
-
-static int
-pid_is_stopped (pid_t pid)
-{
-  FILE *status_file;
-  char buf[100];
-  int retval = 0;
-
-  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
-  status_file = fopen (buf, "r");
-  if (status_file != NULL)
-    {
-      int have_state = 0;
-
-      while (fgets (buf, sizeof (buf), status_file))
-       {
-         if (strncmp (buf, "State:", 6) == 0)
-           {
-             have_state = 1;
-             break;
-           }
-       }
-      if (have_state && strstr (buf, "T (stopped)") != NULL)
-       retval = 1;
-      fclose (status_file);
-    }
-  return retval;
-}
-
 /* Attach to an inferior process.  */
 
 static void
@@ -674,7 +643,7 @@ linux_attach_lwp_1 (unsigned long lwpid, int initial)
      ptrace call on this LWP.  */
   new_lwp->must_set_ptrace_flags = 1;
 
-  if (pid_is_stopped (lwpid))
+  if (linux_proc_pid_is_stopped (lwpid))
     {
       if (debug_threads)
        fprintf (stderr,
This page took 0.024976 seconds and 4 git commands to generate.