diff options
author | Daniel Jacobowitz <drow@false.org> | 2003-06-28 16:19:07 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2003-06-28 16:19:07 +0000 |
commit | 0fac0b4199c69f27906e7343e434dd0b98e5163e (patch) | |
tree | 15f8c0cc45939f9a12172feaf65f5bdc629ac6c8 /gdb/cli-out.c | |
parent | 1579bae1cd094ed9b986d2128997953600ca910d (diff) | |
download | gdb-0fac0b4199c69f27906e7343e434dd0b98e5163e.zip gdb-0fac0b4199c69f27906e7343e434dd0b98e5163e.tar.gz gdb-0fac0b4199c69f27906e7343e434dd0b98e5163e.tar.bz2 |
./
* cli/cli-logging.c: New file.
* cli-out.c (struct ui_out_data): Add original_stream.
(cli_redirect): New function.
(cli_ui_out_impl): Add cli_redirect.
(cli_out_new): Initialize original_stream.
* ui-out.c (default_ui_out_impl): Add NULL for redirect member.
(uo_redirect, ui_out_redirect): New.
* ui-out.h (struct ui_out_impl): Add redirect member.
(redirect_ftype): New.
(ui_out_redirect): Add prototype.
* Makefile.in: Add rules for cli-logging.c.
* NEWS: Mention "set logging".
mi/
* mi-out.c (mi_ui_out_impl): Add NULL for redirect member.
tui/
* tui-out.c (tui_ui_out_impl): Add NULL for redirect member.
doc/
* gdb.texinfo (Logging output): New chapter.
Diffstat (limited to 'gdb/cli-out.c')
-rw-r--r-- | gdb/cli-out.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 38bf36f..2e5a3c1 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -31,6 +31,7 @@ struct ui_out_data { struct ui_file *stream; + struct ui_file *original_stream; int suppress_output; }; typedef struct ui_out_data cli_out_data; @@ -64,6 +65,7 @@ static void cli_message (struct ui_out *uiout, int verbosity, const char *format, va_list args); static void cli_wrap_hint (struct ui_out *uiout, char *identstring); static void cli_flush (struct ui_out *uiout); +static int cli_redirect (struct ui_out *uiout, struct ui_file *outstream); /* This is the CLI ui-out implementation functions vector */ @@ -87,6 +89,7 @@ static struct ui_out_impl cli_ui_out_impl = cli_message, cli_wrap_hint, cli_flush, + cli_redirect, 0, /* Does not need MI hacks (i.e. needs CLI hacks). */ }; @@ -324,6 +327,24 @@ cli_flush (struct ui_out *uiout) gdb_flush (data->stream); } +int +cli_redirect (struct ui_out *uiout, struct ui_file *outstream) +{ + struct ui_out_data *data = ui_out_data (uiout); + if (outstream != NULL) + { + data->original_stream = data->stream; + data->stream = outstream; + } + else if (data->original_stream != NULL) + { + data->stream = data->original_stream; + data->original_stream = NULL; + } + + return 0; +} + /* local functions */ /* Like cli_field_fmt, but takes a variable number of args @@ -362,6 +383,7 @@ cli_out_new (struct ui_file *stream) cli_out_data *data = XMALLOC (cli_out_data); data->stream = stream; + data->original_stream = NULL; data->suppress_output = 0; return ui_out_new (&cli_ui_out_impl, data, flags); } |