* stdin [not found] <7a25c7790703141157j2976120er36c38dc8d9fd6efe@mail.gmail.com> @ 2007-03-14 19:03 ` JJK 2007-03-14 19:05 ` stdin Joel Brobecker 0 siblings, 1 reply; 3+ messages in thread From: JJK @ 2007-03-14 19:03 UTC (permalink / raw) To: gdb Hello there list, Apologies if this is not the correct place to post this question, if you could let me know where is, I shall attempt there. I am using gdb on a program that uses fgets to read from stdin. after launching "gdb program", how may I invoke the program as if I was actually executing "echo wibble | program". thank you for any help you can give me, James ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: stdin 2007-03-14 19:03 ` stdin JJK @ 2007-03-14 19:05 ` Joel Brobecker 2007-03-14 22:51 ` stdin Michael Veksler 0 siblings, 1 reply; 3+ messages in thread From: Joel Brobecker @ 2007-03-14 19:05 UTC (permalink / raw) To: JJK; +Cc: gdb > 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"? -- Joel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: stdin 2007-03-14 19:05 ` stdin Joel Brobecker @ 2007-03-14 22:51 ` Michael Veksler 0 siblings, 0 replies; 3+ messages in thread From: Michael Veksler @ 2007-03-14 22:51 UTC (permalink / raw) To: Joel Brobecker; +Cc: JJK, gdb Joel Brobecker wrote: >> 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"? > > That will work only if 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. Another solution: in (T)CSH: setenv SHELL /bin/zsh or in (BA)SH: export SHELL=/bin/zsh Then: => gdb /bin/cat .... (gdb) r < <(echo ok) 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 true solution. Michael ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-14 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <7a25c7790703141157j2976120er36c38dc8d9fd6efe@mail.gmail.com>
2007-03-14 19:03 ` stdin JJK
2007-03-14 19:05 ` stdin Joel Brobecker
2007-03-14 22:51 ` stdin Michael Veksler
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox