如何使用 scanf 和 ddd 来调试程序?
当ddd
遇到scanf
语句时,它会显示“等待GDB准备就绪”消息。调试活动在此停止。请指导我克服这个错误。
我使用的是 amd64 速龙处理器。
When ddd
encounters a scanf
statement, it displays "Waiting until GDB gets ready" message. The debugging activity stops here. Please guide me of overcoming this bug.
I'm using an amd64 athlon processor.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很惊讶在这件事上花了这么多时间,所以虽然我对 ddd 知之甚少,但问题很可能只是 gdb 正在等待在等待 stdin 上的输入时被读取阻塞的程序。如果您直接运行 gdb,则可以使用以下命令将输入直接输入到程序中:
run
run
run
run
run
run
run
run
run input-file
你需要给你的程序一些输入。
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. If you were running gdb directly, you could direct input to the program by using:
run < input-file
You need to give your program some input.
就像在 gdb 中一样。您可以在 ddd 的底部窗格中输入您的值。只是 ddd 不太擅长绘制光标来表明这是可能的。
It's just like in gdb. You can input your values at the bottom pane of ddd. It's just that ddd is not very good at drawing the cursor to indicate that that's possible.