summaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-09-11 16:00:20 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-09-11 16:00:20 +0000
commite5d232941da2c8502b1c9d3541bc40df84ec5132 (patch)
tree8e42791cd7d670f7cb80977ed33db0767310afa8 /gdb/top.c
parentb42ed799fa280967003c0abff633b8c5d9921353 (diff)
downloadgdb-e5d232941da2c8502b1c9d3541bc40df84ec5132.tar.gz
gdb/
Redirect also uiout and stdtarg{,err} in execute_command_to_string. * cli-logging.c (struct saved_output_files) <targerr>: New. (set_logging_redirect, pop_output_files, handle_redirections): Redirect also gdb_stdtargerr. * defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New declarations. * event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect also gdb_stdtargerr. * top.c (execute_command_to_string): Move make_cleanup_ui_file_delete to the top. Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr. Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop. * tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr. * utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop): New functions. gdb/testsuite/ * gdb.python/python.exp (set height 0, collect help from uiout) (verify help to uiout): New tests.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c
index b29e68dcc93..8ddb2c6b9c9 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -475,12 +475,23 @@ execute_command_to_string (char *p, int from_tty)
str_file = mem_fileopen ();
+ make_cleanup_ui_file_delete (str_file);
make_cleanup_restore_ui_file (&gdb_stdout);
make_cleanup_restore_ui_file (&gdb_stderr);
- make_cleanup_ui_file_delete (str_file);
+ make_cleanup_restore_ui_file (&gdb_stdlog);
+ make_cleanup_restore_ui_file (&gdb_stdtarg);
+ make_cleanup_restore_ui_file (&gdb_stdtargerr);
+
+ if (ui_out_redirect (uiout, str_file) < 0)
+ warning (_("Current output protocol does not support redirection"));
+ else
+ make_cleanup_ui_out_redirect_pop (uiout);
gdb_stdout = str_file;
gdb_stderr = str_file;
+ gdb_stdlog = str_file;
+ gdb_stdtarg = str_file;
+ gdb_stdtargerr = str_file;
execute_command (p, from_tty);