This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PR 12702 - gdb can hang waiting for thread group leader (gdbserver)
- From: Hui Zhu <teawater at gmail dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Sat, 20 Jul 2013 17:59:33 +0800
- Subject: [PATCH] Fix PR 12702 - gdb can hang waiting for thread group leader (gdbserver)
Hi,
I got a issue with leader-exit.exp will hang with target_board=native-gdbserver.
I found the reason is gdbserver still have this issue. So I post a
patch for gdbserver.
Thanks,
Hui
2013-07-20 Hui Zhu <hui@codesourcery.com>
PR gdb/12702
* linux-low.c (my_waitpid): Check if pid is exiting.
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -423,6 +423,15 @@ my_waitpid (int pid, int *status, int fl
if (wnohang)
break;
+ /* If just wait PID and it is exiting, sigsuspend will
+ hang. So check before call it. */
+ if (pid > 0 && linux_proc_pid_is_zombie (pid))
+ {
+ *status = 0;
+ ret = pid;
+ break;
+ }
+
if (debug_threads)
fprintf (stderr, "blocking\n");