Blame SOURCES/gdb-rhel5-compat.patch

f9426a
Index: gdb-7.7/gdb/linux-nat.c
f9426a
===================================================================
f9426a
--- gdb-7.7.orig/gdb/linux-nat.c	2014-02-09 19:18:24.048554459 +0100
f9426a
+++ gdb-7.7/gdb/linux-nat.c	2014-02-09 19:19:22.210622806 +0100
f9426a
@@ -1529,8 +1529,22 @@ get_pending_status (struct lwp_info *lp,
f9426a
 			    gdb_signal_to_string (signo));
f9426a
     }
f9426a
 
f9426a
-  if (*status == 0 && ptid_get_pid (lp->ptid) == pid_was_stopped)
f9426a
-    *status = W_STOPCODE (SIGSTOP);
f9426a
+  /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
f9426a
+     many TIDs are left unstopped).  See RH Bug 496732.  */
f9426a
+  if (ptid_get_pid (lp->ptid) == pid_was_stopped)
f9426a
+    {
f9426a
+      int err;
f9426a
+
f9426a
+      errno = 0;
f9426a
+      err = kill_lwp (ptid_get_lwp (lp->ptid), SIGSTOP);
f9426a
+      if (debug_linux_nat)
f9426a
+	{
f9426a
+	  fprintf_unfiltered (gdb_stdlog,
f9426a
+			      "SC:  lwp kill %d %s\n",
f9426a
+			      err,
f9426a
+			      errno ? safe_strerror (errno) : "ERRNO-OK");
f9426a
+	}
f9426a
+    }
f9426a
 
f9426a
   return 0;
f9426a
 }