From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23144 invoked by alias); 17 Jul 2002 18:30:12 -0000 Mailing-List: contact insight-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sources.redhat.com Received: (qmail 23129 invoked from network); 17 Jul 2002 18:30:10 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 17 Jul 2002 18:30:10 -0000 Received: from dsl254-114-118.nyc1.dsl.speakeasy.net ([216.254.114.118] helo=nevyn.them.org ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17UtYw-0008FO-00; Wed, 17 Jul 2002 13:30:11 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17UtYy-00012V-00; Wed, 17 Jul 2002 14:30:12 -0400 Date: Wed, 17 Jul 2002 11:30:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: insight@sources.redhat.com Subject: RFA: Make cli-out follow gdb_stdout Message-ID: <20020717183012.GA9788@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, insight@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2002-q3/txt/msg00025.txt.bz2 Right now, when you create a cli_out object via cli_out_new, you pass the value of gdb_stdout. If we want to temporarily redirect output, that loses. Rather than temporarily changing the UI, I'd like to have cli_out_new follow gdb_stdout. There were two ways to do this: - hardcode the relationship between cli_out and gdb_stdout, since all callers pass the same thing. - Pass &gdb_stdout instead of gdb_stdout. I opted for the latter, as Pierre originally suggested. If someone's got a preference for the former I can switch easily enough. I need this patch before I can submit the code to support '>' and '>>', based on Tom Tromey's patch from last October. OK? -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2002-07-16 Daniel Jacobowitz * cli-out.c (struct ui_out_data): Change STREAM to `struct ui_file **'. (cli_field_fmt, cli_spaces, cli_text, cli_message) (cli_flush, out_field_fmt, field_separator): Dereference data->stream. (cli_out_new): Change argument to `struct ui_file **'. * cli-out.h (cli_out_new): Update prototype. * top.c (gdb_init): Update call to cli_out_new. 2002-07-16 Daniel Jacobowitz * gdbtk/generic/gdbtk.c (gdbtk_init): Update call to cli_out_new. 2002-07-16 Daniel Jacobowitz * tui/tuiIO.c (tui_initialize_io): Update call to cli_out_new. Index: cli-out.c =================================================================== RCS file: /cvs/src/src/gdb/cli-out.c,v retrieving revision 1.14 diff -u -p -r1.14 cli-out.c --- cli-out.c 19 Mar 2002 02:51:04 -0000 1.14 +++ cli-out.c 16 Jul 2002 16:25:11 -0000 @@ -30,7 +30,7 @@ struct ui_out_data { - struct ui_file *stream; + struct ui_file **stream; int suppress_output; }; @@ -272,7 +272,7 @@ cli_field_fmt (struct ui_out *uiout, int if (data->suppress_output) return; - vfprintf_filtered (data->stream, format, args); + vfprintf_filtered (*data->stream, format, args); if (align != ui_noalign) field_separator (); @@ -284,7 +284,7 @@ cli_spaces (struct ui_out *uiout, int nu struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; - print_spaces_filtered (numspaces, data->stream); + print_spaces_filtered (numspaces, *data->stream); } void @@ -293,7 +293,7 @@ cli_text (struct ui_out *uiout, const ch struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; - fputs_filtered (string, data->stream); + fputs_filtered (string, *data->stream); } void @@ -304,7 +304,7 @@ cli_message (struct ui_out *uiout, int v if (data->suppress_output) return; if (ui_out_get_verblvl (uiout) >= verbosity) - vfprintf_unfiltered (data->stream, format, args); + vfprintf_unfiltered (*data->stream, format, args); } void @@ -320,7 +320,7 @@ void cli_flush (struct ui_out *uiout) { struct ui_out_data *data = ui_out_data (uiout); - gdb_flush (data->stream); + gdb_flush (*data->stream); } /* local functions */ @@ -338,7 +338,7 @@ out_field_fmt (struct ui_out *uiout, int va_list args; va_start (args, format); - vfprintf_filtered (data->stream, format, args); + vfprintf_filtered (*data->stream, format, args); va_end (args); } @@ -349,13 +349,13 @@ static void field_separator (void) { struct ui_out_data *data = ui_out_data (uiout); - fputc_filtered (' ', data->stream); + fputc_filtered (' ', *data->stream); } /* initalize private members at startup */ struct ui_out * -cli_out_new (struct ui_file *stream) +cli_out_new (struct ui_file **stream) { int flags = ui_source_list; Index: cli-out.h =================================================================== RCS file: /cvs/src/src/gdb/cli-out.h,v retrieving revision 1.2 diff -u -p -r1.2 cli-out.h --- cli-out.h 6 Mar 2001 08:21:06 -0000 1.2 +++ cli-out.h 16 Jul 2002 16:25:11 -0000 @@ -22,6 +22,6 @@ #ifndef CLI_OUT_H #define CLI_OUT_H -extern struct ui_out *cli_out_new (struct ui_file *stream); +extern struct ui_out *cli_out_new (struct ui_file **stream); #endif Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.64 diff -u -p -r1.64 top.c --- top.c 11 Jul 2002 13:50:49 -0000 1.64 +++ top.c 16 Jul 2002 16:25:12 -0000 @@ -2090,7 +2090,7 @@ gdb_init (char *argv0) /* Install the default UI */ if (!init_ui_hook) { - uiout = cli_out_new (gdb_stdout); + uiout = cli_out_new (&gdb_stdout); /* All the interpreters should have had a look at things by now. Initialize the selected interpreter. */ Index: gdbtk/generic/gdbtk.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v retrieving revision 1.28 diff -u -p -r1.28 gdbtk.c --- gdbtk/generic/gdbtk.c 17 Apr 2002 18:13:04 -0000 1.28 +++ gdbtk/generic/gdbtk.c 16 Jul 2002 16:25:13 -0000 @@ -587,7 +587,7 @@ gdbtk_init (char *argv0) gdb_stderr = gdbtk_fileopen (); gdb_stdlog = gdbtk_fileopen (); gdb_stdtarg = gdbtk_fileopen (); - uiout = cli_out_new (gdb_stdout); + uiout = cli_out_new (&gdb_stdout); #ifdef __CYGWIN32__ (void) FreeConsole (); Index: tui/tuiIO.c =================================================================== RCS file: /cvs/src/src/gdb/tui/tuiIO.c,v retrieving revision 1.12 diff -u -p -r1.12 tuiIO.c --- tui/tuiIO.c 1 Mar 2002 06:19:28 -0000 1.12 +++ tui/tuiIO.c 16 Jul 2002 16:25:13 -0000 @@ -357,7 +357,7 @@ tui_initialize_io () /* Create the default UI. It is not created because we installed a init_ui_hook. */ - uiout = cli_out_new (gdb_stdout); + uiout = cli_out_new (&gdb_stdout); /* Temporary solution for readline writing to stdout: redirect readline output in a pipe, read that pipe and