关于 cgdb & gdbtui 的输入scanf()问题

本文介绍了在cgdb和gdbtui中调试含有scanf函数的程序时遇到的问题及解决方法。当遇到scanf函数时,调试器似乎进入无限循环。解决办法是在另一个终端启动程序,并使用cgdb附加到该程序;或者通过tty窗口传递参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用cgdb 和 gdbtui 调试程序时, 遇到scanf函数时 it seems to enter into an infinite loop

According to the info page of cgdb, you need to either:

  • start the program on one terminal, and attach to it with CGDB from another terminal
  • or pass arguments using the tty window

To invoke the tty window, hit 'T' in command mode (escape)

Extracted from the info page:

Sending I/O to the program being debugged

This technique is similar to getting in and out of "GDB mode". The tty window is not visible by default. This is because it is only needed if the user wishes to send data to the program being debugged. To display the tty window, hit `T' while in command mode.

调试到scanf 这行, 进入命令模式(ESC), T 会出现 tty window, 输入要发送给IO的数据, 推出此模式(ESC), 继续n...调试,

 

posted on 2017-01-24 00:42 桑海 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/sanghai/p/6345606.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值