简体   繁体   English

如何使用scanf和ddd调试程序?

[英]How can I debug a program using scanf with ddd?

When ddd encounters a scanf statement, it displays "Waiting until GDB gets ready" message. ddd遇到scanf语句时,它显示“正在等待GDB准备就绪”消息。 The debugging activity stops here. 调试活动到此为止。 Please guide me of overcoming this bug. 请指导我克服此错误。

I'm using an amd64 athlon processor. 我正在使用amd64速龙处理器。

I am surprised that so much time has elapsed on this, so although I know little about ddd, it seems very likely that the problem is simply that gdb is waiting for the program which is blocked on a read waiting for input on stdin. 我对此感到惊讶,因为花了这么多时间,所以尽管我对ddd知之甚少,但问题似乎很可能是gdb正在等待该程序,该程序在读取等待stdin的输入时被阻塞。 If you were running gdb directly, you could direct input to the program by using: 如果直接运行gdb,则可以使用以下命令将输入​​直接定向到程序:

run < input-file

You need to give your program some input. 您需要给程序一些输入。

It's just like in gdb. 就像在gdb中一样。 You can input your values at the bottom pane of ddd. 您可以在ddd的底部窗格中输入值。 It's just that ddd is not very good at drawing the cursor to indicate that that's possible. 只是ddd不能很好地绘制光标以表明这是可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM