aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-13 10:47:32 -0600
committerTom Tromey <tom@tromey.com>2017-09-09 13:46:08 -0600
commitca5909c7de7353d8005bf8fdcc020b8f14cc1603 (patch)
tree7f6a92c8c64d4154b16b8a30d6bd7fdde6fe19f3 /gdb/top.c
parente6a2252ac3e3dc748df33b38ac66cd78c80be5ad (diff)
downloadgdb-ca5909c7de7353d8005bf8fdcc020b8f14cc1603.zip
gdb-ca5909c7de7353d8005bf8fdcc020b8f14cc1603.tar.gz
gdb-ca5909c7de7353d8005bf8fdcc020b8f14cc1603.tar.bz2
Remove make_cleanup_ui_out_redirect_pop
This patch introduces ui_out_redirect_pop. All uses of make_cleanup_ui_out_redirect_pop are replaced with this new class. ChangeLog 2017-09-09 Tom Tromey <tom@tromey.com> * mi/mi-interp.c (mi_user_selected_context_changed): Use ui_out_redirect_pop. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Use ui_out_redirect_pop. * utils.c (do_ui_out_redirect_pop) (make_cleanup_ui_out_redirect_pop): Remove. * top.c (execute_command_to_string): Use ui_out_redirect_pop. * utils.h (make_cleanup_ui_out_redirect_pop): Remove. * ui-out.h (ui_out_redirect_pop): New class.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gdb/top.c b/gdb/top.c
index a4fd262..742c1e7 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -679,21 +679,23 @@ execute_command_to_string (char *p, int from_tty)
string_file str_file;
- current_uiout->redirect (&str_file);
- make_cleanup_ui_out_redirect_pop (current_uiout);
-
- scoped_restore save_stdout
- = make_scoped_restore (&gdb_stdout, &str_file);
- scoped_restore save_stderr
- = make_scoped_restore (&gdb_stderr, &str_file);
- scoped_restore save_stdlog
- = make_scoped_restore (&gdb_stdlog, &str_file);
- scoped_restore save_stdtarg
- = make_scoped_restore (&gdb_stdtarg, &str_file);
- scoped_restore save_stdtargerr
- = make_scoped_restore (&gdb_stdtargerr, &str_file);
-
- execute_command (p, from_tty);
+ {
+ current_uiout->redirect (&str_file);
+ ui_out_redirect_pop redirect_popper (current_uiout);
+
+ scoped_restore save_stdout
+ = make_scoped_restore (&gdb_stdout, &str_file);
+ scoped_restore save_stderr
+ = make_scoped_restore (&gdb_stderr, &str_file);
+ scoped_restore save_stdlog
+ = make_scoped_restore (&gdb_stdlog, &str_file);
+ scoped_restore save_stdtarg
+ = make_scoped_restore (&gdb_stdtarg, &str_file);
+ scoped_restore save_stdtargerr
+ = make_scoped_restore (&gdb_stdtargerr, &str_file);
+
+ execute_command (p, from_tty);
+ }
do_cleanups (cleanup);