Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
したがって、ユーザーが端末からテキストを入力する必要があるプログラムをデバッグしようとしています。
$ echo 'here is the text' | ./program
GDB でその入力をシミュレートするにはどうすればよいですか?
入力をリダイレクトしてプログラムを実行できます。
echo 'here is the text' > intput.txt gdb ./program (gdb) run < intput.txt
--args以下のように、プログラム実行可能ファイルの後に引数を指定するオプションを使用して実行できます。
--args
% gdb --args ./program arg1 arg2