summaryrefslogtreecommitdiff
path: root/patches/gdb/6.5/120-thread-timeout.patch
blob: d6f5dd8ceb905977e43ec31da2e4a2ee6e617f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- gdb-6.5/./gdb/gdbserver/thread-db.c.orig	2006-03-15 08:13:29.000000000 -0800
+++ gdb-6.5/./gdb/gdbserver/thread-db.c	2008-04-01 21:21:23.000000000 -0700
@@ -21,6 +21,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
+#include <unistd.h>
 #include "server.h"
 
 #include "linux-low.h"
@@ -134,6 +135,7 @@ thread_db_create_event (CORE_ADDR where)
   td_event_msg_t msg;
   td_err_e err;
   struct inferior_linux_data *tdata;
+  int timeout;
 
   if (debug_threads)
     fprintf (stderr, "Thread creation event.\n");
@@ -144,7 +146,13 @@ thread_db_create_event (CORE_ADDR where)
      In the LinuxThreads implementation, this is safe,
      because all events come from the manager thread
      (except for its own creation, of course).  */
-  err = td_ta_event_getmsg (thread_agent, &msg);
+  for (timeout = 0; timeout < 50000; timeout++)
+    {
+      err = td_ta_event_getmsg (thread_agent, &msg);
+      if (err != TD_NOMSG)
+	break;
+      usleep(1000);
+    }
   if (err != TD_OK)
     fprintf (stderr, "thread getmsg err: %s\n",
 	     thread_db_err_str (err));