patches/gdb/6.3/500-thread-timeout.patch
changeset 96 aa1a9fbd6eb8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gdb/6.3/500-thread-timeout.patch	Thu May 17 16:22:51 2007 +0000
     1.3 @@ -0,0 +1,34 @@
     1.4 +--- gdb-6.3.org/gdb/gdbserver/thread-db.c	2004-10-17 02:42:00.000000000 +0900
     1.5 ++++ gdb-6.3/gdb/gdbserver/thread-db.c	2005-01-27 12:19:29.000000000 +0900
     1.6 +@@ -21,6 +21,7 @@
     1.7 +    Foundation, Inc., 59 Temple Place - Suite 330,
     1.8 +    Boston, MA 02111-1307, USA.  */
     1.9 + 
    1.10 ++#include <unistd.h>
    1.11 + #include "server.h"
    1.12 + 
    1.13 + #include "linux-low.h"
    1.14 +@@ -142,6 +143,7 @@
    1.15 +   td_event_msg_t msg;
    1.16 +   td_err_e err;
    1.17 +   struct inferior_linux_data *tdata;
    1.18 ++  int timeout;
    1.19 + 
    1.20 +   if (debug_threads)
    1.21 +     fprintf (stderr, "Thread creation event.\n");
    1.22 +@@ -152,7 +154,13 @@
    1.23 +      In the LinuxThreads implementation, this is safe,
    1.24 +      because all events come from the manager thread
    1.25 +      (except for its own creation, of course).  */
    1.26 +-  err = td_ta_event_getmsg (thread_agent, &msg);
    1.27 ++  for (timeout = 0; timeout < 50000; timeout++)
    1.28 ++    {
    1.29 ++      err = td_ta_event_getmsg (thread_agent, &msg);
    1.30 ++      if (err != TD_NOMSG)
    1.31 ++	break;
    1.32 ++      usleep(1000);
    1.33 ++    }
    1.34 +   if (err != TD_OK)
    1.35 +     fprintf (stderr, "thread getmsg err: %s\n",
    1.36 + 	     thread_db_err_str (err));
    1.37 +