当程序尝试读取控制台输入时,ddd 调试器进入无限循环
当 C++ 程序从 cin
读取数据时,ddd 会为其提供“1”,而不是让我在其控制台中键入输入。由于程序读取交互式命令,“1”是无效命令,而 ddd 似乎有无限的供应,结果是“无效命令”输出的无限循环。
有人遇到过这种行为并知道如何克服吗?我感到非常沮丧,在 21 世纪我必须使用命令行 gdb,就像 20 年前我在学校所做的那样。 eclipse 的内置调试器太慢了,没什么用处。
ddd 版本是 3.3.11。代码片段:
while (true)
{
cout << greeting;
string cmd;
cin >> cmd;
if (cmd == "e")
{
// etc.
when a C++ program reads from cin
, the ddd provides it with "1" instead of letting me type the input in its console. Since the program reads interactive commands, "1" is an invalid command and ddd seems to have an infinite supply of them, the result is an infinite loop of "invalid command" output.
Have anybody encountered such behavior and knows how to overcome this? I feel so frustrated that in the 21st century I have to use a command-line gdb, as I did in the school 20 years ago. eclipse's built-in debugger is too slow to be useful.
ddd version is 3.3.11. the code snippet:
while (true)
{
cout << greeting;
string cmd;
cin >> cmd;
if (cmd == "e")
{
// etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想要使用 Nemiver 调试器。它有 gnome-console 选项卡,您可以在其中与应用程序进行交互,就像没有调试器一样。
http://www.gnome.org/projects/nemiver
You might want to use Nemiver debugger. It has gnome-console tab where you can interact whith your application as you would do it without debugger.
http://www.gnome.org/projects/nemiver
你确实应该使用 GDB。尝试 Insight GDB 图形用户界面。 http://sourceware.org/insight/
You really should use GDB. Try out the Insight GDB gui. http://sourceware.org/insight/