Blame SOURCES/gdb-rhel5-compat.patch

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