patches/gdb/6.5/500-thread-timeout.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Apr 13 18:03:28 2008 +0000 (2008-04-13)
changeset 438 d75624a9268b
parent 96 aa1a9fbd6eb8
permissions -rw-r--r--
Update patch to gdb. Thanks Khem RAJ <kraj@mvista.com>

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