Description: try to make the PTRACE scope sysctl more discoverable via a verbose error message when failures happen. Author: Kees Cook Index: gdb-7.1/gdb/inf-ptrace.c =================================================================== --- gdb-7.1.orig/gdb/inf-ptrace.c 2010-06-08 15:47:16.238390895 -0700 +++ gdb-7.1/gdb/inf-ptrace.c 2010-06-08 17:29:39.445890685 -0700 @@ -212,7 +212,16 @@ errno = 0; ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0); if (errno != 0) - perror_with_name (("ptrace")); + { + if (errno == EPERM) + { + fprintf_unfiltered (gdb_stderr, + _("Could not attach to process. If your uid matches the uid of the target\n" + "process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\n" + "again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf\n")); + } + perror_with_name (("ptrace")); + } #else error (_("This system does not support attaching to a process")); #endif