From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27558 invoked by alias); 28 Aug 2011 08:52:01 -0000 Received: (qmail 27547 invoked by uid 22791); 28 Aug 2011 08:52:00 -0000 X-SWARE-Spam-Status: No, hits=-2.6 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-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 28 Aug 2011 08:51:46 +0000 Received: by wwe32 with SMTP id 32so4149305wwe.12 for ; Sun, 28 Aug 2011 01:51:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.221.102 with SMTP id q80mr2632925wep.37.1314521503888; Sun, 28 Aug 2011 01:51:43 -0700 (PDT) Received: by 10.216.22.75 with HTTP; Sun, 28 Aug 2011 01:51:43 -0700 (PDT) In-Reply-To: <83pqjsfjsy.fsf@gnu.org> References: <83pqjsfjsy.fsf@gnu.org> Date: Sun, 28 Aug 2011 08:52:00 -0000 Message-ID: Subject: Re: [PATCH][TEST-CASE][DOC] Implementation of pipe to pass GDB's command output to the shell. From: Abhijit Halder To: Eli Zaretskii Cc: gdb-patches@sourceware.org, sergiodj@redhat.com, jan.kratochvil@redhat.com, tromey@redhat.com, pedro@codesourcery.com 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/msg00544.txt.bz2 On Fri, Aug 26, 2011 at 5:48 PM, Eli Zaretskii wrote: >> Date: Fri, 26 Aug 2011 17:13:28 +0530 >> From: Abhijit Halder >> Cc: Eli Zaretskii , Sergio Durigan Junior , >> =A0 =A0 =A0 Jan Kratochvil , Tom Tromey , >> =A0 =A0 =A0 Pedro Alves >> >> I am creating this new thread as the earlier threads went very long. >> This patch contains code change, test-cases and documentation as well. > > Thanks. > >> +@node Output Redirection >> +@chapter Redirecting @value{GDBN}'s Command Output to the Shell > > I'd rather not make this a new chapter. =A0I think a subsection of the > Input/Output node is a much better place. > Actually I could not find such section. Can someone please direct me to the appropriate section? >> +@value{GDBN}'s command output can be redirected to the shell using @cod= e{pipe} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^^^^^^^^^^^^ > "to a shell command", I think. Yes. I will correct this. > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0Even if the environment variable >> +@code{SHELL} is set, the default shell (@file{/bin/sh} on Unix systems, >> +@file{COMMAND.COM} on MS-DOS, etc.) is used. > > This might be seen by some as a > Sorry I am getting this. Please give me some more context. >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 The @code{pipe} command expects >> +in its argument a delimiter string (without having any whitespace), fol= lowed by >> +a @value{GDBN} command, followed by the same delimiter string and final= ly a >> +shell command. =A0The delimiter should not contain any leading `-'. >> + >> +@smallexample >> +(@value{GDBP}) @b{pipe | thread apply all bt | cat >./analyze_threads.l= og} >> +@end smallexample > > Please explain which part is the "delimiter" here. =A0Since you are > using the "normal" shell pipe character `|', the above explanation > about the delimiter string will raise a few brows. =A0A word about why > you need something beyond the usual `|' would also be nice. > Sure. > In addition, I think we should explain which parts of the command are > passed to the shell verbatim and which parts are processed by GDB. =A0If > the last part ("cat >./analyze_threads.log") is passed to the shell, > then it must use the shell syntax (e.g., backslashes on MS-DOS/Windows). > Sure. > Finally, can we have a more useful example than just redirecting the > output to a file? =A0Such redirection can be achieved without this > command at all. > Sure. I will try to provide some useful application. > Please also remove the @b markup, it is not used anywhere in the > examples we have in the manual. > Ok, I think when we need to show the command output along with the command itself, the only the command has to be within @b markup. >> +* New command "pipe" has been added to make GDB command output availabl= e to the >> + =A0shell for processing. > > "available to shell commands" >