Relax threads count checking as the inferior may got stopped before it could
authorlace <>
Fri, 15 Jun 2007 10:01:13 +0000 (10:01 +0000)
committerlace <>
Fri, 15 Jun 2007 10:01:13 +0000 (10:01 +0000)
  initialize.

testsuite.c

index b462938..4bfcd4f 100644 (file)
@@ -65,23 +65,25 @@ static struct attach_state_struct *attach_checked (pid_t pid, int redelivered_ex
                   attach_state_redelivered_get (attach_state));
          abort ();
        }
-      if (attach_state_threads_count_get (attach_state)
-         == spawned_threads_count)
-        break;
       /* During the inferior's initialization we may catch less threads.  */
       assert (attach_state_threads_count_get (attach_state)
-             < spawned_threads_count);
+             <= spawned_threads_count);
+      if (attach_state_threads_count_get (attach_state)
+         == spawned_threads_count
+         /* Inferior may got stopped before it could initialize.  */
+         || attach_state_stopped_get (attach_state) == 1)
+       {
+         /* FIXME: Why also STATE_STOPPED?  */
+         STATE (pid, (1 << STATE_PTRACED) | (1 << STATE_STOPPED));
+         return attach_state;
+       }
       /* WARNING: Currently we never use REDELIVERED_EXPECT but we would have to
          probably reset it back to 0 otherwise.  */
       assert (redelivered_expect == 0);
       detach_checked (attach_state);
     }
   while (loops++ < LOOPS_MIN || time (NULL) < timeout);
-  assert (attach_state_threads_count_get (attach_state) == spawned_threads_count);
-
-  /* FIXME: Why also STATE_STOPPED?  */
-  STATE (pid, (1 << STATE_PTRACED) | (1 << STATE_STOPPED));
-  return attach_state;
+  abort ();
 }
 
 struct registry