-
Notifications
You must be signed in to change notification settings - Fork 223
Troubleshoot attaching to processes using GDB
Wes Rupert edited this page Sep 1, 2016
·
8 revisions
Attaching to a process on Linux with GDB as a normal user may fail with "ptrace:Operation not permitted". By default Linux does not allow attaching to a process which wasn't launched by the debugger (see the Yama security documentation for more details).
There are two ways to workaround this:
-
Run the following command as super user:
echo "0" > /proc/sys/kernel/yama/ptrace_scope
This will set the ptrace level to 0, after this just with user permissions you can attach to processes which are not launched by the debugger.
-
Alternatively, launch GDB as super user and attach to processes.