From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30871 invoked by alias); 14 Mar 2007 22:51:02 -0000 Received: (qmail 30843 invoked by uid 22791); 14 Mar 2007 22:51:00 -0000 X-Spam-Check-By: sourceware.org Received: from mailgw4.technion.ac.il (HELO mailgw4.technion.ac.il) (132.68.238.36) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Mar 2007 22:50:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgw4.technion.ac.il (Postfix) with ESMTP id C21C223FAF1; Thu, 15 Mar 2007 00:50:47 +0200 (IST) Received: from mailgw4.technion.ac.il ([127.0.0.1]) by localhost (mailgw4.technion.ac.il [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UBGHMKVcPEuz; Thu, 15 Mar 2007 00:50:47 +0200 (IST) Received: from techunix.technion.ac.il (techunix.technion.ac.il [132.68.1.28]) by mailgw4.technion.ac.il (Postfix) with ESMTP id 955B923FAE3; Thu, 15 Mar 2007 00:50:33 +0200 (IST) Received: from tp-veksler.haifa.ibm.com (techunix.technion.ac.il [132.68.1.28]) by techunix.technion.ac.il (Postfix) with ESMTP id 4902714BA6; Thu, 15 Mar 2007 00:27:23 +0200 (IST) (envelope-from mveksler@tx.technion.ac.il) Message-ID: <45F876C7.3020700@tx.technion.ac.il> Date: Wed, 14 Mar 2007 22:51:00 -0000 From: Michael Veksler User-Agent: Thunderbird 2.0b2 (X11/20070116) MIME-Version: 1.0 To: Joel Brobecker Cc: JJK , gdb@sourceware.org Subject: Re: stdin References: <7a25c7790703141157j2976120er36c38dc8d9fd6efe@mail.gmail.com> <7a25c7790703141202vb0224aeq6f70ae857c7ac9e@mail.gmail.com> <20070314190554.GM14401@adacore.com> In-Reply-To: <20070314190554.GM14401@adacore.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00205.txt.bz2 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