From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11598 invoked by alias); 13 Aug 2011 20:58:24 -0000 Received: (qmail 11590 invoked by uid 22791); 13 Aug 2011 20:58:24 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_TD 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; Sat, 13 Aug 2011 20:57:57 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7DKvo7H016596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 13 Aug 2011 16:57:50 -0400 Received: from host1.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7DKvmn0026999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 13 Aug 2011 16:57:49 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p7DKvliA005019; Sat, 13 Aug 2011 22:57:47 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p7DKvl4F005017; Sat, 13 Aug 2011 22:57:47 +0200 Date: Sat, 13 Aug 2011 20:58:00 -0000 From: Jan Kratochvil To: Abhijit Halder Cc: Pedro Alves , gdb-patches@sourceware.org, Sergio Durigan Junior , Tom Tromey Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. Message-ID: <20110813205747.GC22058@host1.jankratochvil.net> References: <201108041029.37721.pedro@codesourcery.com> <20110805082947.GA5020@host1.jankratochvil.net> <20110813172342.GA22058@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-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/msg00279.txt.bz2 On Sat, 13 Aug 2011 20:09:57 +0200, Abhijit Halder wrote: > I have also redirected the gdb_stderr to pipe. [...] > + gdb_stdout = fp; > + gdb_stderr = fp; > + gdb_stdlog = fp; > + gdb_stdtarg = fp; > + gdb_stdtargerr = fp; > + execute_command (pipe->gdb_cmd, from_tty); > > But the error is still coming on screen. > > (gdb) pipe | print xxx | vim - > Vim: Reading from stdin... > > No symbol table is loaded. Use the "file" command. > (gdb) pipe | print 2 | vim - > Vim: Reading from stdin... > > (gdb) Hmm, true, the error message is stored in the block but the error message is printed only after the exception cleanups were run. You can use there (do not use this indentation): { volatile struct gdb_exception except; TRY_CATCH (except, RETURN_MASK_ERROR) { execute_command (pipe->gdb_cmd, from_tty); } if (except.reason < 0) exception_print (gdb_stderr, except); } Thanks, Jan