From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15643 invoked by alias); 21 Jul 2011 10:22:34 -0000 Received: (qmail 15633 invoked by uid 22791); 21 Jul 2011 10:22:32 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 10:22:19 +0000 Received: (qmail 7220 invoked from network); 21 Jul 2011 10:22:18 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Jul 2011 10:22:18 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: gdb output pipelining to shell (was: Re: PATCH) Date: Thu, 21 Jul 2011 11:08:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) Cc: Mike Frysinger , Tom Tromey , Abhijit Halder References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107211122.15756.pedro@codesourcery.com> 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-07/txt/msg00575.txt.bz2 On Tuesday 12 July 2011 21:30:00, Mike Frysinger wrote: > On Tue, Jul 12, 2011 at 15:25, Tom Tromey wrote: > >>>>>> "Abhijit" == Abhijit Halder writes: > > Abhijit> How if we just put a condition check whether the entered string after > > Abhijit> pipe (|) is numeric. [...] > > > > I was too terse yesterday. The big problem with any generic approach is > > that GDB syntax is free-form: each command defines its own syntax. So, > > for any syntax you think up, there is a decent chance that it already > > means something to some command, or could. > > > > This doesn't mean it is impossible, just difficult. > > i was also pondering reversing the order. rather than being a suffix > that gets mucked up in syntax, add a pass through. but that too can > get ugly. > > pipe > (gdb) pipe "vim -" thread apply all bt Another option would be to still have a normal order pipe command, and have the user specify the splitting character, kind of like a grandchild of sed's s/// vs s,,, etc, and cat EOF pattern. So, you'd have: pipe SPLITTER_TOKEN the usual | would work: (gdb) pipe | bt | vim - if necessary due to conflict, use a different token: (gdb) pipe , p 1 | 2 , vim - or: (gdb) pipe PIPE p 1 | 2 PIPE vim - etc. WDYT? 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). We can tweak the syntax a bit to support options to the pipe command. E.g, define that the pipe command always ends with a lone '-' before the gdb command chain, and -t for pipe token, then: No -t switch, assume `|' pipe token: (gdb) pipe - bt | vim - Specify alternate pipe token: (gdb) pipe -t PIPE - p 1 | 2 PIPE vim - Pass some other option to `pipe': (gdb) pipe --some-option - bt | vim - -- Pedro Alves