Blame SOURCES/gdb-rhel5-compat.patch

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