KDevelop调试警告:无法设置控制终端:不允许操作 [英] KDevelop debugging warning: Failed to set controlling terminal: Operation not permitted

查看:523
本文介绍了KDevelop调试警告:无法设置控制终端:不允许操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间,我将个人操作系统更改为linux,并将开发环境更改为KDevelop。



但是,调试c ++项目仍然无法正常工作。
我的KDevelop版本是4.2.2(我通过包管理安装)



每次我点击调试按钮应用程序从控制台开始消息
警告:GDB:无法设置控制终端:操作不允许并且调试功能不可用。



任何想法欢迎。



(如果您需要其他信息,请不要犹豫)

解决方案

我也遇到了这个问题,但是我在KDevelop中使用gdb很少,没有让我烦恼。这是我试图解决这个问题的日志:



通过GDB 7.3.1源代码显示,当GDB尝试将其主TTY设置为新的时,打印该消息-created伪tty(参见gdb /current.c,第683-740行)。特别是,对请求TIOCSCTTY的ioctl的调用失败并出现权限错误。



考虑到这一点,我看了一下Linux内核源代码,看看可以造成失败一些搜索显示它最终会退化为一个调用tiocsctty()。来自tiocsctty的评论在这里很重要:

  / * 
*进程必须是会话的领导和
*没有控制tty已经。
* /

由于唯一的其他原因,EPERM可能会失败,如果tty GDB创建实际上是另一个进程(这似乎不大可能)的控制tty,我认为假设GDB不是会话的领导者是合理的。完全可以由KDevelop发起!



所以:我尝试不是在外部终端启动GDB会话,它的工作原理。问题缩小。



最初,外部终端线路设置为 konsole --noclose --workdir%workdir -e%exe 。将此更改为终止符-e%exe 略有不同:KDevelop警告我,

  GDB不能使用tty *或pty *设备。 
检查/ dev / tty *和/ dev / pty *
上的设置作为root,您可能需要chmod ug + rwtty *和pty *设备和/或将用户添加到tty组使用usermod -G tty用户名。

我查看了我的权限;我的用户是tty组的一部分,所有相关文件都是可读写的。



浏览KDevelop源代码,揭示KDevelop如何设置终端。它运行shell脚本

  tty> FIFO_PATH;陷阱INT QUIT TSTP;执行<&  - ; exec>&  - ;而:做睡眠3600;完成

然后设置GDB以使用从FIFO_PATH读取的终端设备。 (我的名字,顺便说一句,不是KDevelop使用的)。问题(尽可能的告诉我),gdb不是作为shell脚本的子进程启动的,因此不能使用它作为它的主要tty。 / p>

我没有感觉到修补KDevelop,以使这项工作正常(或发现实际上导致此停止工作在第一位...),所以现在最好的建议是简单地不用外部终端进行调试。



祝你好运!如果我发现有用,我会更新。


A while ago I changed my personal operating system to linux and my development enviroment to KDevelop.

However debugging c++ projects is still not working as it should. My KDevelop version is 4.2.2 (I installed it through package management)

Every time I hit the "debug button" the application is starting with the console message warning: GDB: Failed to set controlling terminal: Operation not permitted and debugging functionality is not available.

Any ideas welcome.

(If you need additional information don't hesitate to ask)

解决方案

I also had this problem, but I use gdb in KDevelop sparsely enough that hadn't bothered me yet. Here's my log of trying to fix it:

Grepping through the GDB 7.3.1 source code reveals that this message is printed when GDB tries to set its master TTY to a newly-created pseudo-tty (see gdb/inflow.c, lines 683-740). In particular, a call to ioctl with request TIOCSCTTY fails with a permissions error.

With this in mind, I took a look at the Linux kernel source code to see what could cause a failure. A bit of searching shows that it will eventually degenerate into a call to tiocsctty(). The comment from tiocsctty that is important here:

/*
 * The process must be a session leader and
 * not have a controlling tty already.
 */

Since the only other reason it can fail with EPERM is if the tty that GDB creates is actually a controlling tty for another process (which seems highly unlikely), I thought it reasonable to assume that GDB is not a session leader. Fair enough, it's launched by KDevelop after all!

So: I tried not launching the GDB session in an external terminal, and it works. Problem narrowed down.

Originally, the external terminal line was set to konsole --noclose --workdir %workdir -e %exe. Changing this to terminator -e %exe made a slight difference: KDevelop warned me that

GDB cannot use the tty* or pty* devices.
Check the settings on /dev/tty* and /dev/pty*
As root you may need to "chmod ug+rw" tty* and pty* devices and/or add the user to the tty group using "usermod -G tty username".

I checked my permissions; my user was part of the tty group and all relevant files were readable and writable.

Grepping through the KDevelop source code reveals how KDevelop actually sets up the terminal. It runs the shell script

tty > FIFO_PATH ; trap "" INT QUIT TSTP ; exec<&-; exec>&-; while :; do sleep 3600;done

and then sets up GDB to use the terminal device it reads from FIFO_PATH. (My name, by the way, not the one that KDevelop uses.) The problem (as best I can tell) is that gdb is not launched as a child of the shell script, and thus cannot use it as its main tty.

I'm not feeling up to patching KDevelop to make this work properly as of yet (or finding what actually caused this to stop working in the first place . . .), so the best I can suggest at the moment is to simply not use an external terminal for debugging purposes.

Good luck! I'll update if I find anything useful.

这篇关于KDevelop调试警告:无法设置控制终端:不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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