From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Cc: insight@sources.redhat.com
Subject: RFA: Make cli-out follow gdb_stdout
Date: Wed, 17 Jul 2002 11:30:00 -0000 [thread overview]
Message-ID: <20020717183012.GA9788@nevyn.them.org> (raw)
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 <drow@mvista.com>
* 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 <drow@mvista.com>
* gdbtk/generic/gdbtk.c (gdbtk_init): Update call to cli_out_new.
2002-07-16 Daniel Jacobowitz <drow@mvista.com>
* 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
next reply other threads:[~2002-07-17 18:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-17 11:30 Daniel Jacobowitz [this message]
2002-07-22 11:12 ` Andrew Cagney
2002-07-22 11:21 ` Daniel Jacobowitz
2002-07-22 12:18 ` Andrew Cagney
2002-07-22 12:41 ` Daniel Jacobowitz
2002-07-22 13:11 ` Andrew Cagney
2002-07-22 13:18 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020717183012.GA9788@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
--cc=insight@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).