attach: operation not permitted

Hi,

I’m trying to attach to a process but haven’t had success until now.

Tab 1:
$ out/Debug/chrome --no-sandbox --renderer-startup-dialog

[3590:3590:0816/003040:ERROR:child_process.cc(132)] Renderer (3590) paused waiting for debugger to attach. Send SIGUSR1 to unpause.

Tab 2:

$ ls -l ~/llvm/build/bin/lldb
lrwxrwxrwx 1 tfarina tfarina 10 Aug 2 23:44 /home/tfarina/llvm/build/bin/lldb → lldb-3.6.0

$ ~/llvm/build/bin/lldb --version
lldb version 3.6.0 (http://llvm.org/git/lldb.git revision 3c9eeefb4022614373ca99f4e95cd869e6b965e4)

$ ~/llvm/build/bin/lldb
(lldb) attach -p 3590
error: attach failed: Operation not permitted

How can I fix this?

Regards,

I’ve never built lldb on Mac myself, but I think you have to sign the binary, which only works in the XCode build system:
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/code-signing.txt?view=markup

Nevermind, /home probably means you’re on Linux. I think Ubuntu has a similar restriction against ptracing non-child processes. You have to do silly stuff like:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

http://askubuntu.com/questions/41629/after-upgrade-gdb-wont-attach-to-process

(lldb) attach -p 11275
Process 11275 stopped
Executable module set to "/home/tfarina/chromium/src/out/Debug/chrome".
Architecture set to: x86_64-unknown-linux.

Thanks Reid.

Reid, you beat me to it :slight_smile:

-Todd