在Linux上,我试图在Eclipse CDT中使用gdb调试C应用程序 .
例如,应用程序 applic.exe
需要一些命令行参数 arg1
和 arg2
,它需要 stdin
上的一些数据(例如,取自文件 input.txt
) .
通常,要在控制台中运行应用程序,我会这样做:
cat input.txt | applic.exe arg1 arg2
在控制台中使用gdb我可以这样做:
gdb applic.exe
(gdb) run applic.exe arg1 arg2 < input.txt
在Eclipse中使用gdb可以做到这一点吗?我知道如何在Eclipse Debug Configurations中指定参数(和环境),但是 stdin
呢?
2 回答
Eclipse中有Console选项卡(在IDE的底部),您可以将数据放在此处 .
而不是在参数选项卡中输入重定向,而是将其附加到调试配置中的可执行文件名 .