500-thread-timeout.patch 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. --- gdb-6.3.org/gdb/gdbserver/thread-db.c 2004-10-17 02:42:00.000000000 +0900
  2. +++ gdb-6.3/gdb/gdbserver/thread-db.c 2005-01-27 12:19:29.000000000 +0900
  3. @@ -21,6 +21,7 @@
  4. Foundation, Inc., 59 Temple Place - Suite 330,
  5. Boston, MA 02111-1307, USA. */
  6. +#include <unistd.h>
  7. #include "server.h"
  8. #include "linux-low.h"
  9. @@ -142,6 +143,7 @@
  10. td_event_msg_t msg;
  11. td_err_e err;
  12. struct inferior_linux_data *tdata;
  13. + int timeout;
  14. if (debug_threads)
  15. fprintf (stderr, "Thread creation event.\n");
  16. @@ -152,7 +154,13 @@
  17. In the LinuxThreads implementation, this is safe,
  18. because all events come from the manager thread
  19. (except for its own creation, of course). */
  20. - err = td_ta_event_getmsg (thread_agent, &msg);
  21. + for (timeout = 0; timeout < 50000; timeout++)
  22. + {
  23. + err = td_ta_event_getmsg (thread_agent, &msg);
  24. + if (err != TD_NOMSG)
  25. + break;
  26. + usleep(1000);
  27. + }
  28. if (err != TD_OK)
  29. fprintf (stderr, "thread getmsg err: %s\n",
  30. thread_db_err_str (err));