This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/8] gdb.threads/{siginfo-thread.c,watchthreads-reorder.c,ia64-sigill.c} races with GDB
- From: Yao Qi <yao at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Tue, 6 Jan 2015 14:20:42 +0800
- Subject: Re: [PATCH 1/8] gdb.threads/{siginfo-thread.c,watchthreads-reorder.c,ia64-sigill.c} races with GDB
- Authentication-results: sourceware.org; auth=none
- References: <1419625871-28848-1-git-send-email-palves at redhat dot com> <1419625871-28848-2-git-send-email-palves at redhat dot com>
Pedro Alves <palves@redhat.com> writes:
> The issue is that the test program stops GDB before it had a chance of
> processing the new thread's clone event:
>
> (gdb) PASS: gdb.threads/siginfo-threads.exp: get pid
> continue
> Continuing.
> Stopping GDB PID 21541.
> Waiting till the threads initialize their TIDs.
> FAIL: gdb.threads/siginfo-threads.exp: catch signal 0 (timeout)
>
> On Linux (at least), new threads start stopped, and the debugger must
> resume them. The fix is to make the test program wait for the new
> threads to be running before stopping GDB.
Looks there is a deadlock. main thread sends SIGSTOP to gdb and calls
pthread_cond_wait to wait for being notified by child thread. Child
thread is stopped (should be resumed by gdb) and can't notify main
thread. The patch looks right to me.
--
Yao (éå)