gdb/linux-nat.c: - Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595). Index: gdb-7.2.50.20110104/gdb/elfread.c =================================================================== --- gdb-7.2.50.20110104.orig/gdb/elfread.c 2011-01-04 06:15:59.000000000 +0100 +++ gdb-7.2.50.20110104/gdb/elfread.c 2011-01-04 06:17:54.000000000 +0100 @@ -832,7 +832,7 @@ resolve_gnu_ifunc (const char *function_ #define BUILD_ID_VERBOSE_NONE 0 #define BUILD_ID_VERBOSE_FILENAMES 1 #define BUILD_ID_VERBOSE_BINARY_PARSE 2 -static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; +static int build_id_verbose = BUILD_ID_VERBOSE_NONE; static void show_build_id_verbose (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -1920,8 +1920,10 @@ find_separate_debug_file_by_buildid (str /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0) { +#if 0 /* RHEL-5 backward behavior compatibility. */ warning (_("\"%s\": separate debug info file has no debug info"), build_id_name); +#endif xfree (build_id_name); } else if (build_id_name != NULL) Index: gdb-7.2.50.20110104/gdb/corelow.c =================================================================== --- gdb-7.2.50.20110104.orig/gdb/corelow.c 2011-01-04 06:15:57.000000000 +0100 +++ gdb-7.2.50.20110104/gdb/corelow.c 2011-01-04 06:18:08.000000000 +0100 @@ -280,7 +280,7 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current. */ } -static int build_id_core_loads = 1; +static int build_id_core_loads = 0; static void build_id_locate_exec (int from_tty) Index: gdb-7.2.50.20110104/gdb/linux-nat.c =================================================================== --- gdb-7.2.50.20110104.orig/gdb/linux-nat.c 2011-01-04 06:15:59.000000000 +0100 +++ gdb-7.2.50.20110104/gdb/linux-nat.c 2011-01-04 06:17:54.000000000 +0100 @@ -1762,8 +1762,22 @@ GPT: lwp %s had signal %s, but it is in target_signal_to_string (signo)); } - if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) - *status = W_STOPCODE (SIGSTOP); + /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that + many TIDs are left unstopped). See RH Bug 496732. */ + if (GET_PID (lp->ptid) == pid_was_stopped) + { + int err; + + errno = 0; + err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP); + if (debug_linux_nat) + { + fprintf_unfiltered (gdb_stdlog, + "SC: lwp kill %d %s\n", + err, + errno ? safe_strerror (errno) : "ERRNO-OK"); + } + } return 0; }