在 Eclipse 的调试器控制台中发送 EOF
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5494958/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Send an EOF in Eclipse's debugger console
提问by Charles Offenbacher
I have a program that takes console input that I'm trying to debug. Sending an EOF (Ctrl+D in shell) is important to its function; but Ctrl+D doesn't send one in Eclipse's debugger console.
我有一个程序,它接受我正在尝试调试的控制台输入。发送 EOF(在 shell 中为 Ctrl+D)对其功能很重要;但是 Ctrl+D 不会在 Eclipse 的调试器控制台中发送一个。
This should be super simple, but Google (and my limited experience) yields nothing. Thanks so much for any help!
这应该非常简单,但谷歌(和我有限的经验)一无所获。非常感谢您的帮助!
采纳答案by Matt
It's a bug, see here:
这是一个错误,请参见此处:
Passing End of Transmission (Ctrl + D) character in Eclipse CDT console
回答by Mahdi
I just found a solution to this problem:
我刚刚找到了解决此问题的方法:
When you finish entering your inputs on console, click on another window (editor, Project Explorer, etc.), then click back on console. Hitting Ctrl+ Zwill work now.
在控制台上完成输入后,单击另一个窗口(编辑器、项目资源管理器等),然后单击返回控制台。现在点击Ctrl+Z就可以了。
回答by vpit3833
I think it(not responding to Ctrl+D on Unix/Linux systems and not responding to Ctrl+Z on DOS?Windows systems) was a bug some 2 3 years back. Eclipse mailing lists or bugs database should have better information about it. Refer herefor more info on the bug report.
我认为它(在 Unix/Linux 系统上不响应 Ctrl+D,在 DOS?Windows 系统上不响应 Ctrl+Z)是大约 2 3 年前的一个错误。Eclipse 邮件列表或错误数据库应该有更好的信息。有关错误报告的更多信息,请参阅此处。
回答by Serge Voloshenko
On mac for C++ projects try to disable this feature: Go to Run -> Run configurations... Uncheck Connect process input & output to a terminal. It worked for me.
在 Mac 上的 C++ 项目尝试禁用此功能:转到运行 -> 运行配置...取消选中将进程输入和输出连接到终端。它对我有用。
回答by Andersnk
For some reason the trick by focusing something else and then refocussing the console only works in the 'normal' perspective, and not in the debugging perspective for me.
出于某种原因,通过聚焦其他东西然后重新聚焦控制台的技巧仅适用于“正常”视角,而不适用于我的调试视角。
Another workaround is to use an external console. This can be configured here:
另一种解决方法是使用外部控制台。这可以在这里配置:
- Press
Run
in the upper menu - Choose
Debug
Configurations - Go to the
Debugger
tab - Check
Use external console for inferior (open a new console window for input/output)
- 按
Run
上层菜单 - 选择
Debug
配置 - 转到
Debugger
选项卡 - 查看
Use external console for inferior (open a new console window for input/output)
Works for both the normal perspective and the debugging perspective for me.
对我来说既适用于普通视角,也适用于调试视角。