简体   繁体   中英

Cannot debug with gdb in ubuntu

Qt creator throws an error every time I want to start debugging. Here is the error:

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

I have googled the error message and got some result about bug in the kernel but I am able to run gdb in command line, so I don't think it is kernel/gdb related.

What can be the cause of this error?

I just did some research and found the solution somewhere. It turns out that /proc/sys/kernel/yama/ptrace_scope was set to 1. After I changed it to 0, the problem disappeared.

Explanations of ptrace can be found here and here , as Merlin069 said.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM