imr*_*mre 2 terminal stdin gdb stream
所以我试图调试一个程序,要求用户通过终端输入一些文本:
$ echo 'here is the text' | ./program
Run Code Online (Sandbox Code Playgroud)
如何在GDB中模拟输入?
您可以使用重定向的输入运行程序:
echo 'here is the text' > intput.txt
gdb ./program
(gdb) run < intput.txt
Run Code Online (Sandbox Code Playgroud)