Runing an app in a terminal with a debugger on Linux using Qt Creator

别来无恙 提交于 2019-12-11 19:39:15

问题


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:

  1. In QtCreator console I cannot input data (debugger working)
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!