使用Qt Creator在Linux上使用调试器在终端中运行应用程序 [英] Runing an app in a terminal with a debugger on Linux using Qt Creator

查看:171
本文介绍了使用Qt Creator在Linux上使用调试器在终端中运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Kubuntu 12.04上用Qt Creator 2.4.1编写的简单的控制台应用程序。我的应用程序有简单的菜单,您可以选择想要做的事情(使用 std :: cin getline()



问题是我无法在Qt Creator中的控制台中输入数据。所以我使用选项运行在终端(xterm)。但是当我想运行调试器时,我得到ptrace操作不允许。



所以:


  1. 在QtCreator控制台中,我无法输入数据(调试器工作)

  2. 在终端我不能使用调试器(不允许使用ptrace操作)

我需要两者:输入数据和调试器。



任何解决方案如何处理?

解决方案

我发现这个解决方案快速搜索后:

  $ sudo su  -  
$ echo 0> / proc / sys / kernel / yama / ptrace_scope

执行此操作后,我可以运行应用程序在调试模式中,但是调试器没有停止在我的断点。也许这将适用于您的申请。


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?

解决方案

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.

这篇关于使用Qt Creator在Linux上使用调试器在终端中运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆