在Qt Creator中调试C++
代码时,出现以下错误
ptrace: Operation not permitted.
Could not attach to the process. Make sure no other debugger traces this process.
Check the settings of
/proc/sys/kernel/yama/ptrace_scope
For more details, see /etc/sysctl.d/10-ptrace.conf
在这里找到一个临时解决方案:Receiving error while trying to debug in QtProject
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
但是,每次启动PC使用Qt时,都很难在终端中运行相同的代码。
What is the permanent solution for this?
最佳答案
如果运行Ubuntu,
启用所需的ptrace内核设置(由qtcreator提示)的推荐方法是编辑/etc/sysctl.d/10-ptrace.conf
sudo vim /etc/sysctl.d/10-ptrace.conf
然后改变
kernel.yama.ptrace_scope = 1
至
kernel.yama.ptrace_scope = 0
保存,
然后申请:
$ sudo sysctl --system -a -p|grep yama
kernel.yama.ptrace_scope = 0
跑
man sysctl
有关更多信息。
关于c++ - Qt Creator,ptrace : Operation not permitted.永久解决方案是什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22120711/