While debugging C++ code in Qt creator I get the following error
ptrace: Operation not permitted.
Could not attach to the process. Make sure no
I got the answer.
Go to the location /etc with root privilege.
Find the file rc.local.
echo 0 | tee /proc/sys/kernel/yama/ptrace_scopeRestart your pc and you can see the debugger working perfectly.
If running Ubuntu,
The recommended way to enable the needed ptrace kernel setting (hinted by qtcreator) is to edit /etc/sysctl.d/10-ptrace.conf
sudo vim /etc/sysctl.d/10-ptrace.conf
Then change
kernel.yama.ptrace_scope = 1
to
kernel.yama.ptrace_scope = 0
Save,
then apply:
$ sudo sysctl --system -a -p|grep yama
kernel.yama.ptrace_scope = 0
run
man sysctl
for more info.
I found the answer that works for me on ubuntu in below link and the credit goes to dstzcxr
https://askubuntu.com/a/501271/395583
Just uncheck (or check - run - uncheck if it is for some reason unchecked) the box "Run in terminal" in "Projects" (on the left bar) - "Run" tab - "Run" section.