This is the mail archive of the
mailing list for the GDB project.
Joel Brobecker wrote:
That will work only if
after launching "gdb program", how may I invoke the program as if I
was actually executing "echo wibble | program".
Not tested, but would you be able to put the text you want to pipe
into a file, and then do "run < your_file"?
1. your_file is small enough. I sometimes pipe GBs of data through pipes.
2. You don't mind that the behavior of pipes and files is different
in some cases. The bug that you hunt might go away due to this
difference (like it might disappear by changing an unrelated
environment variable - yes I have seen such bugs).
Also, a program such as 'less' might behave differently, on
purpose, when reading from a pipe and not a file.
in (T)CSH: setenv SHELL /bin/zsh
or in (BA)SH: export SHELL=/bin/zsh
=> gdb /bin/cat
(gdb) r < <(echo ok)
What happens here is that <(some command) means that the command is run,
its output is written to a pipe. The pipe gets a name (named pipe or
through /dev/fd/[0-9]), and that name is used in
(gdb) r < the_name_of_the_pipe
Actual implementation may be different (because '<' does not require a
name), but the main idea remains. Anyway, this is a work-around, not a