This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[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");


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