问题
I have simple console application in C++ written in Qt Creator 2.4.1 on Kubuntu 12.04. My app have simple menu where you choose what you want to do (using std::cin
and getline()
).
The problem is that I cannot input data in console in Qt Creator. So I use option "Run in terminal" (xterm). But when I want to run debugger I get "ptrace operation not allowed".
So:
- In QtCreator console I cannot input data (debugger working)
- In terminal I cannot use debugger (ptrace operation not allowed)
I need both: input data and debugger.
Any solutions how to handle this?
回答1:
I found this solution after quick googling:
$ sudo su -
$ echo 0 > /proc/sys/kernel/yama/ptrace_scope
After doing this, I was able to run the application in debug modus, but the debugger did not stop at my breakpoints. Maybe it will work for your application.
来源:https://stackoverflow.com/questions/11343826/runing-an-app-in-a-terminal-with-a-debugger-on-linux-using-qt-creator