From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15649 invoked by alias); 2 Aug 2011 08:52:46 -0000 Received: (qmail 15636 invoked by uid 22791); 2 Aug 2011 08:52:45 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ew0-f41.google.com (HELO mail-ew0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 08:52:28 +0000 Received: by ewy9 with SMTP id 9so3775519ewy.0 for ; Tue, 02 Aug 2011 01:52:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.114.66 with SMTP id d2mr1843677ebq.102.1312275147468; Tue, 02 Aug 2011 01:52:27 -0700 (PDT) Received: by 10.213.16.210 with HTTP; Tue, 2 Aug 2011 01:52:27 -0700 (PDT) In-Reply-To: <20110802065411.GA23915@host1.jankratochvil.net> References: <20110802065411.GA23915@host1.jankratochvil.net> Date: Tue, 02 Aug 2011 08:52:00 -0000 Message-ID: Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. From: Abhijit Halder To: Jan Kratochvil Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00025.txt.bz2 On Tue, Aug 2, 2011 at 12:24 PM, Jan Kratochvil wrote: > On Fri, 29 Jul 2011 15:35:10 +0200, Abhijit Halder wrote: > On Fri, Jul 29, 2011 at 6:45 PM, Abhijit Halder wrote: >> This is the implementation of a new gdb command, named 'pipe', to make >> ease of I/O communication between gdb and shell. >> The syntax of this command is shown as follows: >> (gdb) pipe [option] gdb-cmd shell-cmd >> List of options go with pipe command: >> =A0-r =A0 gdb reads output of shell-command from pipe >> =A0-w =A0gdb passes output of a command to shell to process. > > When is useful to feed input of a GDB command from some file/process? > It is IMO useful only for `run' but that will not work this way. > Yes. I made this option (-r) available just to make the code futuristic. To feed input to `run' command, we still need to make changes in the `run' command interface itself. > >> =A0- =A0 =A0end of gdb option list >> dlim (delimiter) is a single ASCII character from the set below: >> {|/\'"`#@!$%^} (We actually can remove this restriction). > > I would prefer first to agree on the proper syntax. =A0I do not find > > (gdb) pipe | print 1 | less > > to be something a new user will ever try whether it does not work. > Can't we introduce a new command and make the user educated to use that (using documentation and all)? Introducing a new command instead of using some meta-character (like '|') will give us more flexibility and that will be ease of maintenance. At the same time this will be more futuristic. Pedro Alves mentioned in a similar line: "I think I like this better than comming up with some syntax that we need to make sure works not just with C, but all supported languages. (and hope no future supported language adds a conflict)." I also do think that the introduction of a new command will be a better approach. > The original idea of: > > (gdb) print 1 | less > > looks fine to me as in normal cases one never uses `|' in the GDB command= s. > Still for example for the `echo' GDB command one may use `|' as both the > `echo' argument and also one may want to pass the output to some shell. > We can still support inline pipe (print 1 | less) along with pipe command. But the question of maintainability will appear. > If there is pipe `|' GDB could support also redirections '>', '>>', '2>&1= ', > '&>', '|&' besides '|' etc. > The same can still be very much possible with pipe command in place. For e.= g. (gdb) pipe | thread apply all bt | grep "foobar" 2>&1 | tee myLog.txt > There could be some disable of the option being enabled by default: > > (gdb) set shell-metachars off > > > Thanks, > Jan >