使用gdb进行C程序调试!

q_v_i_t 2005-10-17 08:51:11
如果gcc编译后生成的可执行文件运行时需要数据文件作为参数,那怎么单步调试了??
e.g.
生成的可执行文件是test,数据文件是a.txt,正常运行时为test a.txt;

那么此时用gdb调试时,怎么把a.txt作为参数输入了??
...全文
364 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mefit 2005-10-18
  • 打赏
  • 举报
回复
gdb test
b main
r a.txt
doway 2005-10-17
  • 打赏
  • 举报
回复
倒,这回真倒,我见过的最恶心的名字。
021850524 2005-10-17
  • 打赏
  • 举报
回复
gdb
file test
set args a.txt
break main
run
boxban 2005-10-17
  • 打赏
  • 举报
回复
set args:
Specify the arguments to be used the next time your program is run. If set
args has no arguments, run executes your program with no arguments. Once
you have run your program with arguments, using set args before the next
run is the only way to run it again without arguments.

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧