On Linux, Debugging a C++ application with gdb in Eclipse CDT, how to input something to stdin?

萝らか妹 提交于 2019-12-08 18:11:00

问题


On Linux, I am trying to debug a C++ application with gdb in Eclipse CDT.

For example the application applic.exe takes some command line arguments arg1 and arg2 and it expects some data on stdin (say, taken from a file input.txt).

Normally, to run the application in the console I would do this:

cat input.txt | applic.exe arg1 arg2

Using gdb in the console I can do:

gdb applic.exe
(gdb) run applic.exe arg1 arg2 < input.txt

Is it possible to do that with gdb in Eclipse? I know how to specify the arguments (and the environment) in the Eclipse Debug Configurations, but what about stdin?


回答1:


There is Console tab in Eclipse (at the bottom of IDE) you can put your data here.




回答2:


Instead of entering the redirection in the arguments tab, append it to the executable file name in the debug configuration.



来源:https://stackoverflow.com/questions/8851881/on-linux-debugging-a-c-application-with-gdb-in-eclipse-cdt-how-to-input-some

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!