From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24476 invoked by alias); 30 Aug 2010 09:29:24 -0000 Received: (qmail 24463 invoked by uid 22791); 30 Aug 2010 09:29:23 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_RP_RNBL,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from smtp-out2.tiscali.nl (HELO smtp-out2.tiscali.nl) (195.241.79.177) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Aug 2010 09:29:18 +0000 Received: from [212.123.169.34] (helo=[192.168.1.102]) by smtp-out2.tiscali.nl with esmtp (Exim) (envelope-from ) id 1Oq0fz-0006Wy-Os for gdb-patches@sourceware.org; Mon, 30 Aug 2010 11:29:16 +0200 Subject: [PATCH] tui-out: don't "inherit" redirect from CLI From: Paul Bolle To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" Date: Mon, 30 Aug 2010 09:29:00 -0000 Message-ID: <1283160550.10594.1.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-08/txt/msg00500.txt.bz2 Since revision 1.17 tui_ui_out_impl "inherits" from cli_ui_out_impl (ie, it starts as a copy of that struct). tui_ui_out_impl.redirect is never redefined after that so it points to cli_redirect(). (Before revision 1.17 it was NULL.) As a consequence, uo_redirect() will actually try to redirect if passed a tui_ui_out_impl. That will probably crash gdb (as tui_ui_out_impl->data->stream and tui_ui_out_impl->data->original_stream don't exist). So set tui_ui_out_impl.redirect to NULL after "inheriting". (Just something I noticed while trying to understand the ui code.) --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-out.c | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5d81848..1beb8fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-08-30 Paul Bolle + + * tui/tui-out.c (_initialize_tui_out): Don't "inherit" redirect from + CLI. + 2010-08-28 Jan Kratochvil Code cleanup. diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 8cd6b88..1e8ef74 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -178,4 +178,5 @@ _initialize_tui_out (void) tui_ui_out_impl.field_string = tui_field_string; tui_ui_out_impl.field_fmt = tui_field_fmt; tui_ui_out_impl.text = tui_text; + tui_ui_out_impl.redirect = NULL; } -- 1.7.2.1