From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2778 invoked by alias); 17 Apr 2011 15:39:10 -0000 Received: (qmail 2768 invoked by uid 22791); 17 Apr 2011 15:39:09 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Apr 2011 15:38:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3HFcoTu000615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 17 Apr 2011 11:38:50 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3HFcmL7015475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 17 Apr 2011 11:38:50 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p3HFcmE5022002; Sun, 17 Apr 2011 17:38:48 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p3HFckoW022001; Sun, 17 Apr 2011 17:38:46 +0200 Date: Sun, 17 Apr 2011 15:39:00 -0000 From: Jan Kratochvil To: "Amker.Cheng" Cc: gdb@sourceware.org Subject: Re: how to redirect output of sub program in target extended-remote Message-ID: <20110417153846.GA21796@host1.jankratochvil.net> References: <20110417133512.GA1067@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00086.txt.bz2 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 command > 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' it should expect remote protocol packets on its standard input, and send 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 visible 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'. Regards, Jan