This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb attach hang (w/pthreads on Cygwin)


gdb on Cygwin can not attach to a running process if the main thread has
exited via a call to pthread_exit().  The attach just hangs.

Here is the  test case: w/o GDB_HANG defined, all is well; with GDB_HANG
defined, attaching is not possible.

#include <pthread.h>
#include <unistd.h>

void *
spinner(void *v)
{
    for (;;) sleep(500);

    return NULL;
}

int
main(void)
{
    pthread_t tid;

    pthread_create(&tid, NULL, spinner, NULL);
#ifdef GDB_HANG
    pthread_exit(NULL);
#else
    for (;;) sleep(500);
#endif

    return 0;
}

Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]