From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29819 invoked by alias); 3 Sep 2010 22:07:03 -0000 Received: (qmail 29809 invoked by uid 22791); 3 Sep 2010 22:07:02 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_TD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out1.tiscali.nl (HELO smtp-out1.tiscali.nl) (195.241.79.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Sep 2010 22:06:39 +0000 Received: from [212.123.169.34] (helo=[192.168.1.102]) by smtp-out1.tiscali.nl with esmtp (Exim) (envelope-from ) id 1OreP6-0004Ml-U9; Sat, 04 Sep 2010 00:06:37 +0200 Subject: Re: [patch] Fix uiout for execute_command_to_string From: Paul Bolle To: Jan Kratochvil Cc: gdb-patches@sourceware.org In-Reply-To: <20100903180619.GA15409@host1.dyn.jankratochvil.net> References: <20100903180619.GA15409@host1.dyn.jankratochvil.net> Content-Type: text/plain; charset="UTF-8" Date: Sat, 04 Sep 2010 15:36:00 -0000 Message-ID: <1283551592.3230.27.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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: 2010-09/txt/msg00138.txt.bz2 On Fri, 2010-09-03 at 20:06 +0200, Jan Kratochvil wrote: > Redirected there also gdb_stdlog as it seems appropriate to me. That is > remain unredirected gdb_stdin, gdb_stdtargin, gdb_stdtarg and gdb_stdtargerr, > I do not much understand gdb_stdtarg* but it seems to +/- match other > redirections in GDB. It seems I need the (trivial) patch below (to be applied on your recent work) to also get the output from remote commands invoked by the python command redirected to a string. Example: foo = gdb.execute("monitor foo", to_string=True) I can't recall exactly why this is needed. (It's about a week ago that I noticed this, while trying to understand https://bugzilla.redhat.com/show_bug.cgi?id=627506 ). Paul --- diff -up gdb-7.1.90.20100806/gdb/top.c.gdbstdt_arg gdb-7.1.90.20100806/gdb/top.c --- gdb-7.1.90.20100806/gdb/top.c.gdbstdt_arg 2010-09-03 23:01:23.000000000 +0200 +++ gdb-7.1.90.20100806/gdb/top.c 2010-09-03 23:25:12.000000000 +0200 @@ -480,6 +480,7 @@ execute_command_to_string (char *p, int make_cleanup_restore_ui_file (&gdb_stdout); make_cleanup_restore_ui_file (&gdb_stderr); make_cleanup_restore_ui_file (&gdb_stdlog); + make_cleanup_restore_ui_file (&gdb_stdtarg); if (ui_out_redirect (uiout, str_file) < 0) warning (_("Current output protocol does not support redirection")); @@ -489,6 +490,7 @@ execute_command_to_string (char *p, int gdb_stdout = str_file; gdb_stderr = str_file; gdb_stdlog = str_file; + gdb_stdtarg = str_file; execute_command (p, from_tty);