Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Veksler <mveksler@tx.technion.ac.il>
To: Joel Brobecker <brobecker@adacore.com>
Cc: JJK <jamesjohnkearney@gmail.com>, gdb@sourceware.org
Subject: Re: stdin
Date: Wed, 14 Mar 2007 22:51:00 -0000	[thread overview]
Message-ID: <45F876C7.3020700@tx.technion.ac.il> (raw)
In-Reply-To: <20070314190554.GM14401@adacore.com>

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


      reply	other threads:[~2007-03-14 22:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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     ` Michael Veksler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45F876C7.3020700@tx.technion.ac.il \
    --to=mveksler@tx.technion.ac.il \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=jamesjohnkearney@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox