Recently, I have been using QT to write C + + programs, but in the process of writing a problem, want to use the debugger in Qt creator debugging, but debugging (in the Qt creator configured the appropriate debugger) appears "Ptrace:operation not Permitted "error, as shown in:
Search by Baidu, found the cause of the problem and its solution.
Originally, in the version after Ubuntu 11.04 ("Natty Narwhal"), a security mechanism called Ptrace scope was introduced. This mechanism prevents the user from accessing the memory and state of the currently running process, which causes the debugger of the QT creator not to work properly. This security mechanism prevents malware from being attached to other processes (such as SSH or GPG) and reads program memory, creating security issues.
This error occurs especially in the version after Ubuntu 11.04, in order to solve this problem, there are two methods, both of which require root permissions.
The first workaround is to temporarily resolve the problem, but it will fail the next time you restart the system. By setting the contents of the/proc/sys/kernel/yama/ptrace_scope virtual file to 0, use the command:
sudo Echo 0 >/proc/sys/kernel/yama/ptrace_scope
The second workaround is to permanently resolve the problem by editing the/etc/sysctl.d/10-ptrace.conf file and setting:
0(default is 1)
The reboot system is in effect.
When the above problem is resolved, another problem arises: set the breakpoint to stop .
Reason: Has not compiled the debug version, has been using the release version to Debug.
Workaround: Configure the Debug version and recompile.
If only the errors shown in debugging occur, this is an issue with insufficient permissions.
Workaround: Use sudo./qtcreator to start, for convenience, you can create a qtcreator shortcut under home, so that you do not have to CD to the directory of the program every time.
Use of the QT debugger under ubuntu12.04