Blame SOURCES/gdb-rhel5-compat.patch

861f93
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
861f93
===================================================================
861f93
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c	2012-06-02 20:54:30.000000000 +0200
861f93
+++ gdb-7.4.50.20120602/gdb/linux-nat.c	2012-06-02 20:56:03.966493352 +0200
861f93
@@ -1816,8 +1816,22 @@ get_pending_status (struct lwp_info *lp,
861f93
 			    gdb_signal_to_string (signo));
861f93
     }
861f93
 
861f93
-  if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
861f93
-    *status = W_STOPCODE (SIGSTOP);
861f93
+  /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
861f93
+     many TIDs are left unstopped).  See RH Bug 496732.  */
861f93
+  if (GET_PID (lp->ptid) == pid_was_stopped)
861f93
+    {
861f93
+      int err;
861f93
+
861f93
+      errno = 0;
861f93
+      err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
861f93
+      if (debug_linux_nat)
861f93
+	{
861f93
+	  fprintf_unfiltered (gdb_stdlog,
861f93
+			      "SC:  lwp kill %d %s\n",
861f93
+			      err,
861f93
+			      errno ? safe_strerror (errno) : "ERRNO-OK");
861f93
+	}
861f93
+    }
861f93
 
861f93
   return 0;
861f93
 }