Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating echo input with GDB

So I am trying to debug a program which requires the user to input some text through the terminal:

$ echo 'here is the text' | ./program

How do I simulate that input in GDB?

like image 561
imre Avatar asked Sep 05 '25 03:09

imre


1 Answers

You can run the program with input redirected:

echo 'here is the text' > intput.txt
gdb ./program
(gdb) run < intput.txt
like image 68
Employed Russian Avatar answered Sep 07 '25 22:09

Employed Russian