From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12807 invoked by alias); 18 Apr 2011 10:21:03 -0000 Received: (qmail 12797 invoked by uid 22791); 18 Apr 2011 10:21:02 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-yi0-f41.google.com (HELO mail-yi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Apr 2011 10:20:43 +0000 Received: by yib18 with SMTP id 18so2117431yib.0 for ; Mon, 18 Apr 2011 03:20:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.153.73 with SMTP id e49mr3292607yhk.154.1303122043301; Mon, 18 Apr 2011 03:20:43 -0700 (PDT) Received: by 10.146.167.11 with HTTP; Mon, 18 Apr 2011 03:20:43 -0700 (PDT) In-Reply-To: <20110417153846.GA21796@host1.jankratochvil.net> References: <20110417133512.GA1067@host1.jankratochvil.net> <20110417153846.GA21796@host1.jankratochvil.net> Date: Mon, 18 Apr 2011 10:21:00 -0000 Message-ID: Subject: Re: how to redirect output of sub program in target extended-remote From: "Amker.Cheng" To: Jan Kratochvil Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-04/txt/msg00089.txt.bz2 On Sun, Apr 17, 2011 at 11:38 PM, Jan Kratochvil wrote: > On Sun, 17 Apr 2011 16:09:39 +0200, Amker.Cheng wrote: >> I wonder whether '2' in your command stands for stderr as in shell comma= nd >> line? > > Yes. > > >> when I typed following command: >> (gdb) target extended-remote | stub_program 1>/tmp/file >> the GDB always failed the connect with message: >> Ignoring packet error, continuing... >> warning: unrecognized item "timeout" in "qSupported" response > > $ info '(gdb)Connecting' > `target remote | COMMAND' > =A0 =A0 =A0 =A0it should expect remote protocol packets on its standard i= nput, and > =A0 =A0 =A0 =A0send replies on its standard output. > > Therefore 1>/tmp/file is the same as >/tmp/file and this way no gdbserver > packets can be received by GDB. > > >> while your command ran successfully. > > STDERR (2) is not used for gdbserver communication, only STDIN (0) > and STDOUT (1). > > If stub_program outputs anything to stdout on its own it (a) cannot be vi= sible > on the screen and (b) it is corrupting the gdbserver protocol although the > gdbserver protocol is resistant against such extraneous data. > > >> I did not understand the pipe in gdb command line well and did not >> find any doc on it. So could you point out some doc and let me learn >> it. > > This is normal shell processing, see `man bash'. Thanks Jan. --=20 Best Regards.