diff options
author | Tom Tromey <tromey@adacore.com> | 2022-08-11 10:07:18 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-08-31 11:03:39 -0600 |
commit | 992aeed80b0a6ef1d60ce01df52f3397c3274f35 (patch) | |
tree | 1a7af982504b79000f29ccf44ef52e739b7e1a97 /gdb/mi | |
parent | 55a6603404099c0b61a5e4613712d3935c2e2bb6 (diff) | |
download | gdb-992aeed80b0a6ef1d60ce01df52f3397c3274f35.zip gdb-992aeed80b0a6ef1d60ce01df52f3397c3274f35.tar.gz gdb-992aeed80b0a6ef1d60ce01df52f3397c3274f35.tar.bz2 |
Use ui_out_redirect_pop in more places
This changes ui_out_redirect_pop to also perform the redirection, and
then updates several sites to use this, rather than explicit
redirects.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-interp.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 368c13f..ed097cf 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -816,16 +816,14 @@ mi_tsv_modified (const struct trace_state_variable *tsv) gdb_printf (mi->event_channel, "tsv-modified"); - mi_uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (mi_uiout, mi->event_channel); mi_uiout->field_string ("name", tsv->name); mi_uiout->field_string ("initial", - plongest (tsv->initial_value)); + plongest (tsv->initial_value)); if (tsv->value_known) mi_uiout->field_string ("current", plongest (tsv->value)); - mi_uiout->redirect (NULL); - gdb_flush (mi->event_channel); } } @@ -844,7 +842,7 @@ mi_print_breakpoint_for_event (struct mi_interp *mi, breakpoint *bp) break if anything is output to mi_uiout prior to calling the breakpoint_created notifications. So, we use ui_out_redirect. */ - mi_uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (mi_uiout, mi->event_channel); try { @@ -857,8 +855,6 @@ mi_print_breakpoint_for_event (struct mi_interp *mi, breakpoint *bp) { exception_print (gdb_stderr, ex); } - - mi_uiout->redirect (NULL); } /* Emit notification about a created breakpoint. */ @@ -1090,12 +1086,10 @@ mi_solib_loaded (struct so_list *solib) gdb_printf (mi->event_channel, "library-loaded"); - uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (uiout, mi->event_channel); mi_output_solib_attribs (uiout, solib); - uiout->redirect (NULL); - gdb_flush (mi->event_channel); } } @@ -1118,7 +1112,7 @@ mi_solib_unloaded (struct so_list *solib) gdb_printf (mi->event_channel, "library-unloaded"); - uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (uiout, mi->event_channel); uiout->field_string ("id", solib->so_original_name); uiout->field_string ("target-name", solib->so_original_name); @@ -1128,8 +1122,6 @@ mi_solib_unloaded (struct so_list *solib) uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num); } - uiout->redirect (NULL); - gdb_flush (mi->event_channel); } } @@ -1157,13 +1149,11 @@ mi_command_param_changed (const char *param, const char *value) gdb_printf (mi->event_channel, "cmd-param-changed"); - mi_uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (mi_uiout, mi->event_channel); mi_uiout->field_string ("param", param); mi_uiout->field_string ("value", value); - mi_uiout->redirect (NULL); - gdb_flush (mi->event_channel); } } @@ -1193,7 +1183,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr, gdb_printf (mi->event_channel, "memory-changed"); - mi_uiout->redirect (mi->event_channel); + ui_out_redirect_pop redir (mi_uiout, mi->event_channel); mi_uiout->field_fmt ("thread-group", "i%d", inferior->num); mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr); @@ -1210,8 +1200,6 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr, mi_uiout->field_string ("type", "code"); } - mi_uiout->redirect (NULL); - gdb_flush (mi->event_channel); } } @@ -1243,8 +1231,7 @@ mi_user_selected_context_changed (user_selected_what selection) mi_uiout = top_level_interpreter ()->interp_ui_out (); - mi_uiout->redirect (mi->event_channel); - ui_out_redirect_pop redirect_popper (mi_uiout); + ui_out_redirect_pop redirect_popper (mi_uiout, mi->event_channel); target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); |