about summary refs log tree commit diff
path: root/linuxthreads_db/td_ta_map_id2thr.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads_db/td_ta_map_id2thr.c')
-rw-r--r--linuxthreads_db/td_ta_map_id2thr.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/linuxthreads_db/td_ta_map_id2thr.c b/linuxthreads_db/td_ta_map_id2thr.c
index e6be74ff19..ddeb2d3c4a 100644
--- a/linuxthreads_db/td_ta_map_id2thr.c
+++ b/linuxthreads_db/td_ta_map_id2thr.c
@@ -45,7 +45,19 @@ td_ta_map_id2thr (const td_thragent_t *ta, pthread_t pt, td_thrhandle_t *th)
 
   /* Test whether this entry is in use.  */
   if (phc.h_descr == NULL)
-    return TD_BADTH;
+    {
+      if (pt % pthread_threads_max == 0)
+	{
+	  /* The initial thread always exists but the thread library
+	     might not yet be initialized.  */
+	  th->th_ta_p = (td_thragent_t *) ta;
+	  th->th_unique = NULL;
+
+	  return TD_OK;
+	}
+
+      return TD_BADTH;
+    }
 
   /* Next test: get the descriptor to see whether this is not an old
      thread handle.  */