diff options
author | Pedro Alves <palves@redhat.com> | 2011-08-04 19:10:14 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-08-04 19:10:14 +0000 |
commit | 79a45e254f090b628473614054ed318d70409239 (patch) | |
tree | 895d3401ff636850ce886625217c84259cbb791f | |
parent | 2011-08-04 Pedro Alves <pedro@codesourcery.com> (diff) | |
download | binutils-gdb-79a45e254f090b628473614054ed318d70409239.tar.gz binutils-gdb-79a45e254f090b628473614054ed318d70409239.tar.bz2 binutils-gdb-79a45e254f090b628473614054ed318d70409239.zip |
2011-08-04 Pedro Alves <pedro@codesourcery.com>
* ui-out.h (uiout): Rename to ...
(current_uiout): ... this.
* ui-out.c (uiout): Rename to ...
(current_uiout): ... this.
* ada-lang.c (print_it_exception, print_one_exception)
(print_mention_exception): Adjust.
* breakpoint.c (watchpoint_check): Adjust.
(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
(default_collect_info, watchpoints_info, print_one_catch_fork)
(print_one_catch_vfork, print_one_catch_syscall)
(print_one_catch_exec, mention, print_it_ranged_breakpoint)
(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
(print_it_watchpoint, print_mention_watchpoint)
(print_it_masked_watchpoint, print_mention_masked_watchpoint)
(print_it_exception_catchpoint, print_one_exception_catchpoint)
(print_mention_exception_catchpoint, say_where, bkpt_print_it)
(bkpt_print_mention, momentary_bkpt_print_it)
(tracepoint_print_mention, update_static_tracepoint)
(tracepoints_info, save_breakpoints): Adjust.
* cli-out.c (field_separator): Adjust.
* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
* frame.c (get_current_frame): Adjust.
* infcmd.c (run_command_1, print_return_value): Adjust.
* inferior.c (inferior_command, info_inferiors_command): Adjust.
* infrun.c (print_end_stepping_range_reason): Adjust.
(print_signal_exited_reason, print_exited_reason): Adjust.
(print_signal_received_reason, print_no_history_reason): Adjust.
* interps.c (interp_set): Adjust.
* osdata.c (info_osdata_command): Adjust.
* progspace.c (maintenance_info_program_spaces_command): Adjust.
* remote-fileio.c (remote_fileio_request): Adjust.
* remote.c (show_remote_cmd): Adjust.
* solib.c (info_sharedlibrary_command): Adjust.
* source.c (print_source_lines_base): Adjust.
* stack.c (print_stack_frame): Adjust.
(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
* symfile-mem.c (add_vsyscall_page): Adjust.
* symfile.c (load_progress, generic_load)
(print_transfer_performance): Adjust.
* thread.c (info_threads_command, restore_selected_frame)
(thread_command): Adjust.
* top.c (make_cleanup_restore_ui_file): Adjust.
* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
(print_one_static_tracepoint_marker): Adjust.
* cli/cli-cmds.c (print_disassembly): Adjust.
* cli/cli-decode.c (print_doc_line): Adjust.
* cli/cli-interp.c (safe_execute_command): Adjust.
* cli/cli-logging.c (set_logging_redirect, pop_output_files)
(handle_redirections): Adjust.
* cli/cli-script.c (show_user_1): Adjust.
* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
(mi_cmd_env_dir): Adjust.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
(list_args_or_locals): Adjust.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
(mi_cmd_var_list_children, mi_cmd_var_info_type)
(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
* mi/mi-interp.c (mi_on_normal_stop): Adjust.
* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
(list_available_thread_groups, mi_cmd_list_thread_groups)
(mi_cmd_data_list_register_names)
(mi_cmd_data_list_changed_registers)
(mi_cmd_data_list_register_values, get_register)
(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
(mi_cmd_list_target_features, mi_cmd_add_inferior)
(mi_execute_command, mi_load_progress): Adjust.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
* python/py-auto-load.c (print_script, info_auto_load_scripts):
Adjust.
* python/py-breakpoint.c (bppy_get_commands): Adjust.
* tui/tui-interp.c (tui_command_loop): Adjust.
* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.
44 files changed, 270 insertions, 75 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 570fca8b38d..60ad1aa8c6f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,93 @@ 2011-08-04 Pedro Alves <pedro@codesourcery.com> + * ui-out.h (uiout): Rename to ... + (current_uiout): ... this. + * ui-out.c (uiout): Rename to ... + (current_uiout): ... this. + * ada-lang.c (print_it_exception, print_one_exception) + (print_mention_exception): Adjust. + * breakpoint.c (watchpoint_check): Adjust. + (print_breakpoint_location, print_one_breakpoint, breakpoint_1) + (default_collect_info, watchpoints_info, print_one_catch_fork) + (print_one_catch_vfork, print_one_catch_syscall) + (print_one_catch_exec, mention, print_it_ranged_breakpoint) + (print_one_ranged_breakpoint, print_mention_ranged_breakpoint) + (print_it_watchpoint, print_mention_watchpoint) + (print_it_masked_watchpoint, print_mention_masked_watchpoint) + (print_it_exception_catchpoint, print_one_exception_catchpoint) + (print_mention_exception_catchpoint, say_where, bkpt_print_it) + (bkpt_print_mention, momentary_bkpt_print_it) + (tracepoint_print_mention, update_static_tracepoint) + (tracepoints_info, save_breakpoints): Adjust. + * cli-out.c (field_separator): Adjust. + * cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust. + * exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust. + * frame.c (get_current_frame): Adjust. + * infcmd.c (run_command_1, print_return_value): Adjust. + * inferior.c (inferior_command, info_inferiors_command): Adjust. + * infrun.c (print_end_stepping_range_reason): Adjust. + (print_signal_exited_reason, print_exited_reason): Adjust. + (print_signal_received_reason, print_no_history_reason): Adjust. + * interps.c (interp_set): Adjust. + * osdata.c (info_osdata_command): Adjust. + * progspace.c (maintenance_info_program_spaces_command): Adjust. + * remote-fileio.c (remote_fileio_request): Adjust. + * remote.c (show_remote_cmd): Adjust. + * solib.c (info_sharedlibrary_command): Adjust. + * source.c (print_source_lines_base): Adjust. + * stack.c (print_stack_frame): Adjust. + (do_gdb_disassembly, print_frame_info, print_frame): Adjust. + * symfile-mem.c (add_vsyscall_page): Adjust. + * symfile.c (load_progress, generic_load) + (print_transfer_performance): Adjust. + * thread.c (info_threads_command, restore_selected_frame) + (thread_command): Adjust. + * top.c (make_cleanup_restore_ui_file): Adjust. + * tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1) + (print_one_static_tracepoint_marker): Adjust. + * cli/cli-cmds.c (print_disassembly): Adjust. + * cli/cli-decode.c (print_doc_line): Adjust. + * cli/cli-interp.c (safe_execute_command): Adjust. + * cli/cli-logging.c (set_logging_redirect, pop_output_files) + (handle_redirections): Adjust. + * cli/cli-script.c (show_user_1): Adjust. + * cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust. + * mi/mi-cmd-break.c (breakpoint_notify): Adjust. + * mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust. + * mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path) + (mi_cmd_env_dir): Adjust. + * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) + (print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust. + * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames) + (mi_cmd_stack_info_depth, mi_cmd_stack_list_args) + (list_args_or_locals): Adjust. + * mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create) + (mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen) + (mi_cmd_var_show_format, mi_cmd_var_info_num_children) + (mi_cmd_var_list_children, mi_cmd_var_info_type) + (mi_cmd_var_info_path_expression, mi_cmd_var_info_expression) + (mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression) + (mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust. + * mi/mi-interp.c (mi_on_normal_stop): Adjust. + * mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select) + (mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior) + (list_available_thread_groups, mi_cmd_list_thread_groups) + (mi_cmd_data_list_register_names) + (mi_cmd_data_list_changed_registers) + (mi_cmd_data_list_register_values, get_register) + (mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory) + (mi_cmd_data_read_memory_bytes, mi_cmd_list_features) + (mi_cmd_list_target_features, mi_cmd_add_inferior) + (mi_execute_command, mi_load_progress): Adjust. + * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust. + * python/py-auto-load.c (print_script, info_auto_load_scripts): + Adjust. + * python/py-breakpoint.c (bppy_get_commands): Adjust. + * tui/tui-interp.c (tui_command_loop): Adjust. + * tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust. + +2011-08-04 Pedro Alves <pedro@codesourcery.com> + * exceptions.c (struct catcher): Remove saved_uiout field. (exceptions_state_mc_init): Remove the `func_uiout' parameter, and no longer save/resvore the global ui_out builder. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 02115de7342..1dabd0fa669 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11078,6 +11078,7 @@ check_status_exception (enum exception_catchpoint_kind ex, bpstat bs) static enum print_stop_action print_it_exception (enum exception_catchpoint_kind ex, bpstat bs) { + struct ui_out *uiout = current_uiout; struct breakpoint *b = bs->breakpoint_at; annotate_catchpoint (b->number); @@ -11150,6 +11151,7 @@ static void print_one_exception (enum exception_catchpoint_kind ex, struct breakpoint *b, struct bp_location **last_loc) { + struct ui_out *uiout = current_uiout; struct ada_catchpoint *c = (struct ada_catchpoint *) b; struct value_print_options opts; @@ -11199,6 +11201,7 @@ print_mention_exception (enum exception_catchpoint_kind ex, struct breakpoint *b) { struct ada_catchpoint *c = (struct ada_catchpoint *) b; + struct ui_out *uiout = current_uiout; ui_out_text (uiout, b->disposition == disp_del ? _("Temporary catchpoint ") : _("Catchpoint ")); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 96d78ac173d..1495a5eb207 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3685,6 +3685,8 @@ watchpoint_check (void *p) } else { + struct ui_out *uiout = current_uiout; + /* This seems like the only logical thing to do because if we temporarily ignored the watchpoint, then when we reenter the block in which it is valid it contains @@ -4498,6 +4500,7 @@ static void print_breakpoint_location (struct breakpoint *b, struct bp_location *loc) { + struct ui_out *uiout = current_uiout; struct cleanup *old_chain = save_current_program_space (); if (loc != NULL && loc->shlib_disabled) @@ -4616,6 +4619,7 @@ print_one_breakpoint_location (struct breakpoint *b, struct command_line *l; static char bpenables[] = "nynny"; + struct ui_out *uiout = current_uiout; int header_of_multiple = 0; int part_of_multiple = (loc != NULL); struct value_print_options opts; @@ -4906,6 +4910,7 @@ print_one_breakpoint (struct breakpoint *b, int allflag) { struct cleanup *bkpt_chain; + struct ui_out *uiout = current_uiout; bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt"); @@ -5031,6 +5036,7 @@ breakpoint_1 (char *args, int allflag, struct value_print_options opts; int print_address_bits = 0; int print_type_col_width = 14; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); @@ -5177,6 +5183,8 @@ breakpoint_1 (char *args, int allflag, static void default_collect_info (void) { + struct ui_out *uiout = current_uiout; + /* If it has no value (which is frequently the case), say nothing; a message like "No default-collect." gets in user's face when it's not wanted. */ @@ -5202,6 +5210,7 @@ static void watchpoints_info (char *args, int from_tty) { int num_printed = breakpoint_1 (args, 0, is_watchpoint); + struct ui_out *uiout = current_uiout; if (num_printed == 0) { @@ -6165,6 +6174,7 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc) { struct fork_catchpoint *c = (struct fork_catchpoint *) b; struct value_print_options opts; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); @@ -6260,6 +6270,7 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc) { struct fork_catchpoint *c = (struct fork_catchpoint *) b; struct value_print_options opts; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); /* Field 4, the address, is omitted (which makes the columns not @@ -6501,6 +6512,7 @@ print_one_catch_syscall (struct breakpoint *b, { struct syscall_catchpoint *c = (struct syscall_catchpoint *) b; struct value_print_options opts; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); /* Field 4, the address, is omitted (which makes the columns not @@ -6743,6 +6755,7 @@ print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc) { struct exec_catchpoint *c = (struct exec_catchpoint *) b; struct value_print_options opts; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); @@ -7027,7 +7040,7 @@ static void mention (struct breakpoint *b) { b->ops->print_mention (b); - if (ui_out_is_mi_like_p (uiout)) + if (ui_out_is_mi_like_p (current_uiout)) return; printf_filtered ("\n"); } @@ -8160,6 +8173,7 @@ print_it_ranged_breakpoint (bpstat bs) { struct breakpoint *b = bs->breakpoint_at; struct bp_location *bl = b->loc; + struct ui_out *uiout = current_uiout; gdb_assert (b->type == bp_hardware_breakpoint); @@ -8192,6 +8206,7 @@ print_one_ranged_breakpoint (struct breakpoint *b, { struct bp_location *bl = b->loc; struct value_print_options opts; + struct ui_out *uiout = current_uiout; /* Ranged breakpoints have only one location. */ gdb_assert (bl && bl->next == NULL); @@ -8241,6 +8256,7 @@ static void print_mention_ranged_breakpoint (struct breakpoint *b) { struct bp_location *bl = b->loc; + struct ui_out *uiout = current_uiout; gdb_assert (bl); gdb_assert (b->type == bp_hardware_breakpoint); @@ -8668,6 +8684,7 @@ print_it_watchpoint (bpstat bs) struct ui_stream *stb; enum print_stop_action result; struct watchpoint *w; + struct ui_out *uiout = current_uiout; gdb_assert (bs->bp_location_at != NULL); @@ -8760,6 +8777,7 @@ print_mention_watchpoint (struct breakpoint *b) { struct cleanup *ui_out_chain; struct watchpoint *w = (struct watchpoint *) b; + struct ui_out *uiout = current_uiout; switch (b->type) { @@ -8874,6 +8892,7 @@ static enum print_stop_action print_it_masked_watchpoint (bpstat bs) { struct breakpoint *b = bs->breakpoint_at; + struct ui_out *uiout = current_uiout; /* Masked watchpoints have only one location. */ gdb_assert (b->loc && b->loc->next == NULL); @@ -8940,6 +8959,7 @@ static void print_mention_masked_watchpoint (struct breakpoint *b) { struct watchpoint *w = (struct watchpoint *) b; + struct ui_out *uiout = current_uiout; struct cleanup *ui_out_chain; switch (b->type) @@ -9720,6 +9740,7 @@ catch_exec_command_1 (char *arg, int from_tty, static enum print_stop_action print_it_exception_catchpoint (bpstat bs) { + struct ui_out *uiout = current_uiout; struct breakpoint *b = bs->breakpoint_at; int bp_temp, bp_throw; @@ -9754,6 +9775,7 @@ print_one_exception_catchpoint (struct breakpoint *b, struct bp_location **last_loc) { struct value_print_options opts; + struct ui_out *uiout = current_uiout; get_user_print_options (&opts); if (opts.addressprint) @@ -9777,6 +9799,7 @@ print_one_exception_catchpoint (struct breakpoint *b, static void print_mention_exception_catchpoint (struct breakpoint *b) { + struct ui_out *uiout = current_uiout; int bp_temp; int bp_throw; @@ -10650,6 +10673,7 @@ bpstat_remove_breakpoint_callback (struct thread_info *th, void *data) static void say_where (struct breakpoint *b) { + struct ui_out *uiout = current_uiout; struct value_print_options opts; get_user_print_options (&opts); @@ -10888,6 +10912,7 @@ bkpt_print_it (bpstat bs) struct breakpoint *b; const struct bp_location *bl; int bp_temp; + struct ui_out *uiout = current_uiout; gdb_assert (bs->bp_location_at != NULL); @@ -10919,7 +10944,7 @@ bkpt_print_it (bpstat bs) static void bkpt_print_mention (struct breakpoint *b) { - if (ui_out_is_mi_like_p (uiout)) + if (ui_out_is_mi_like_p (current_uiout)) return; switch (b->type) @@ -11069,6 +11094,8 @@ momentary_bkpt_check_status (bpstat bs) static enum print_stop_action momentary_bkpt_print_it (bpstat bs) { + struct ui_out *uiout = current_uiout; + if (ui_out_is_mi_like_p (uiout)) { struct breakpoint *b = bs->breakpoint_at; @@ -11134,7 +11161,7 @@ tracepoint_print_one_detail (const struct breakpoint *self, static void tracepoint_print_mention (struct breakpoint *b) { - if (ui_out_is_mi_like_p (uiout)) + if (ui_out_is_mi_like_p (current_uiout)) return; switch (b->type) @@ -11500,6 +11527,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal) struct symtab_and_line sal; struct symbol *sym; struct static_tracepoint_marker *marker; + struct ui_out *uiout = current_uiout; marker = VEC_index (static_tracepoint_marker_p, markers, 0); @@ -12765,6 +12793,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp) static void tracepoints_info (char *args, int from_tty) { + struct ui_out *uiout = current_uiout; int num_printed; num_printed = breakpoint_1 (args, 0, is_tracepoint); @@ -13079,12 +13108,12 @@ save_breakpoints (char *filename, int from_tty, fprintf_unfiltered (fp, " commands\n"); - ui_out_redirect (uiout, fp); + ui_out_redirect (current_uiout, fp); TRY_CATCH (ex, RETURN_MASK_ALL) { - print_command_lines (uiout, tp->commands->commands, 2); + print_command_lines (current_uiout, tp->commands->commands, 2); } - ui_out_redirect (uiout, NULL); + ui_out_redirect (current_uiout, NULL); if (ex.reason < 0) throw_exception (ex); diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 9a8515d9854..8c85c38e27a 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -342,7 +342,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, static void field_separator (void) { - cli_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (current_uiout); struct ui_file *stream = VEC_last (ui_filep, data->streams); fputc_filtered (' ', stream); diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index d4b29a213d4..ccf6ea6ebb0 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1063,7 +1063,7 @@ print_disassembly (struct gdbarch *gdbarch, const char *name, paddress (gdbarch, low), paddress (gdbarch, high)); /* Dump the specified range. */ - gdb_disassembly (gdbarch, uiout, 0, flags, -1, low, high); + gdb_disassembly (gdbarch, current_uiout, 0, flags, -1, low, high); printf_filtered ("End of assembler dump.\n"); gdb_flush (gdb_stdout); diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 744d52e1872..622ee686784 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1018,7 +1018,7 @@ print_doc_line (struct ui_file *stream, char *str) line_buffer[p - str] = '\0'; if (islower (line_buffer[0])) line_buffer[0] = toupper (line_buffer[0]); - ui_out_text (uiout, line_buffer); + ui_out_text (current_uiout, line_buffer); } /* Print one-line help for command C. diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 32883cfbe53..32848495f08 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -118,8 +118,8 @@ safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty) struct ui_out *saved_uiout; /* Save and override the global ``struct ui_out'' builder. */ - saved_uiout = uiout; - uiout = command_uiout; + saved_uiout = current_uiout; + current_uiout = command_uiout; TRY_CATCH (e, RETURN_MASK_ALL) { @@ -127,7 +127,7 @@ safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty) } /* Restore the global builder. */ - uiout = saved_uiout; + current_uiout = saved_uiout; /* FIXME: cagney/2005-01-13: This shouldn't be needed. Instead the caller should print the exception. */ diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index d0e25ea5550..46f89c0333b 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -81,6 +81,7 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) { struct cleanup *cleanups = NULL; struct ui_file *output, *new_logging_no_redirect_file; + struct ui_out *uiout = current_uiout; if (saved_filename == NULL || (logging_redirect != 0 && logging_no_redirect_file == NULL) @@ -166,7 +167,7 @@ pop_output_files (void) saved_output.targ = NULL; saved_output.targerr = NULL; - ui_out_redirect (uiout, NULL); + ui_out_redirect (current_uiout, NULL); } /* This is a helper for the `set logging' command. */ @@ -226,7 +227,7 @@ handle_redirections (int from_tty) gdb_stdtarg = output; gdb_stdtargerr = output; - if (ui_out_redirect (uiout, output) < 0) + if (ui_out_redirect (current_uiout, output) < 0) warning (_("Current output protocol does not support redirection")); } diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index c94f7eedaac..66fa220b310 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -1661,7 +1661,7 @@ show_user_1 (struct cmd_list_element *c, char *prefix, char *name, return; fprintf_filtered (stream, "User command \"%s%s\":\n", prefix, name); - print_command_lines (uiout, cmdlines, 1); + print_command_lines (current_uiout, cmdlines, 1); fputs_filtered ("\n", stream); } diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 8dbfaadde62..5e4846630b4 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -125,6 +125,8 @@ deprecated_show_value_hack (struct ui_file *ignore_file, void do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) { + struct ui_out *uiout = current_uiout; + if (c->type == set_cmd) { switch (c->var_type) @@ -411,6 +413,7 @@ void cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix) { struct cleanup *showlist_chain; + struct ui_out *uiout = current_uiout; showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist"); for (; list != NULL; list = list->next) diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index 040962eba2c..82a164ed52f 100644 --- a/gdb/cp-abi.c +++ b/gdb/cp-abi.c @@ -262,6 +262,7 @@ find_cp_abi (const char *short_name) static void list_cp_abis (int from_tty) { + struct ui_out *uiout = current_uiout; struct cleanup *cleanup_chain; int i; @@ -309,6 +310,8 @@ set_cp_abi_cmd (char *args, int from_tty) static void show_cp_abi_cmd (char *args, int from_tty) { + struct ui_out *uiout = current_uiout; + ui_out_text (uiout, "The currently selected C++ ABI is \""); ui_out_field_string (uiout, "cp-abi", current_cp_abi.shortname); diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 6704f93e8dd..23a85fe54a2 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -462,16 +462,16 @@ catch_exceptions_with_msg (struct ui_out *func_uiout, struct ui_out *saved_uiout; /* Save and override the global ``struct ui_out'' builder. */ - saved_uiout = uiout; - uiout = func_uiout; + saved_uiout = current_uiout; + current_uiout = func_uiout; TRY_CATCH (exception, RETURN_MASK_ALL) { - val = (*func) (uiout, func_args); + val = (*func) (current_uiout, func_args); } /* Restore the global builder. */ - uiout = saved_uiout; + current_uiout = saved_uiout; if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0) { @@ -511,7 +511,7 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, struct ui_out *saved_uiout; /* Save the global ``struct ui_out'' builder. */ - saved_uiout = uiout; + saved_uiout = current_uiout; TRY_CATCH (exception, RETURN_MASK_ALL) { @@ -519,7 +519,7 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, } /* Restore the global builder. */ - uiout = saved_uiout; + current_uiout = saved_uiout; if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0) { diff --git a/gdb/frame.c b/gdb/frame.c index 7a3519222ff..37f106a92b2 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1306,8 +1306,8 @@ get_current_frame (void) { struct frame_info *sentinel_frame = create_sentinel_frame (current_program_space, get_current_regcache ()); - if (catch_exceptions (uiout, unwind_to_current_frame, sentinel_frame, - RETURN_MASK_ERROR) != 0) + if (catch_exceptions (current_uiout, unwind_to_current_frame, + sentinel_frame, RETURN_MASK_ERROR) != 0) { /* Oops! Fake a current frame? Is this useful? It has a PC of zero, for instance. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 0a38c64c7e8..3e8bf5d1884 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -503,6 +503,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main) char *exec_file; struct cleanup *old_chain; ptid_t ptid; + struct ui_out *uiout = current_uiout; dont_repeat (); @@ -1421,6 +1422,7 @@ print_return_value (struct type *func_type, struct type *value_type) struct cleanup *old_chain; struct ui_stream *stb; struct value *value; + struct ui_out *uiout = current_uiout; CHECK_TYPEDEF (value_type); gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID); diff --git a/gdb/inferior.c b/gdb/inferior.c index bfdbf302a40..b4b33dead18 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -732,10 +732,10 @@ inferior_command (char *args, int from_tty) } if (inf->pid != 0 && is_running (inferior_ptid)) - ui_out_text (uiout, "(running)\n"); + ui_out_text (current_uiout, "(running)\n"); else if (inf->pid != 0) { - ui_out_text (uiout, "\n"); + ui_out_text (current_uiout, "\n"); print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC); } } @@ -745,7 +745,7 @@ inferior_command (char *args, int from_tty) static void info_inferiors_command (char *args, int from_tty) { - print_inferior (uiout, args); + print_inferior (current_uiout, args); } /* remove-inferior ID */ diff --git a/gdb/infrun.c b/gdb/infrun.c index f92bc9b20dc..3022f9ba19d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5614,8 +5614,8 @@ print_end_stepping_range_reason (void) { if ((!inferior_thread ()->step_multi || !inferior_thread ()->control.stop_step) - && ui_out_is_mi_like_p (uiout)) - ui_out_field_string (uiout, "reason", + && ui_out_is_mi_like_p (current_uiout)) + ui_out_field_string (current_uiout, "reason", async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE)); } @@ -5624,6 +5624,8 @@ print_end_stepping_range_reason (void) static void print_signal_exited_reason (enum target_signal siggnal) { + struct ui_out *uiout = current_uiout; + annotate_signalled (); if (ui_out_is_mi_like_p (uiout)) ui_out_field_string @@ -5649,6 +5651,7 @@ print_exited_reason (int exitstatus) { struct inferior *inf = current_inferior (); const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid)); + struct ui_out *uiout = current_uiout; annotate_exited (exitstatus); if (exitstatus) @@ -5685,6 +5688,8 @@ print_exited_reason (int exitstatus) static void print_signal_received_reason (enum target_signal siggnal) { + struct ui_out *uiout = current_uiout; + annotate_signal (); if (siggnal == TARGET_SIGNAL_0 && !ui_out_is_mi_like_p (uiout)) @@ -5722,7 +5727,7 @@ print_signal_received_reason (enum target_signal siggnal) static void print_no_history_reason (void) { - ui_out_text (uiout, "\nNo more reverse-execution history.\n"); + ui_out_text (current_uiout, "\nNo more reverse-execution history.\n"); } /* Here to return control to GDB when the inferior stops for real. diff --git a/gdb/interps.c b/gdb/interps.c index c03d424e2ec..f0428069d48 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -150,7 +150,7 @@ interp_set (struct interp *interp, int top_level) if (current_interpreter != NULL) { - ui_out_flush (uiout); + ui_out_flush (current_uiout); if (current_interpreter->procs->suspend_proc && !current_interpreter->procs->suspend_proc (current_interpreter-> data)) @@ -178,7 +178,7 @@ interp_set (struct interp *interp, int top_level) interpreter_p = xstrdup (current_interpreter->name); } - uiout = interp->interpreter_out; + current_uiout = interp->interpreter_out; /* Run the init proc. If it fails, try to restore the old interp. */ @@ -214,7 +214,7 @@ interp_set (struct interp *interp, int top_level) { sprintf (buffer, "Switching to interpreter \"%.24s\".\n", interp->name); - ui_out_text (uiout, buffer); + ui_out_text (current_uiout, buffer); } display_gdb_prompt (NULL); } diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index fee8f73051f..c98330d7d43 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -50,7 +50,7 @@ static void breakpoint_notify (struct breakpoint *b) { if (mi_can_breakpoint_notify) - gdb_breakpoint_query (uiout, b->number, NULL); + gdb_breakpoint_query (current_uiout, b->number, NULL); } enum bp_type diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index 28e84f661d8..6cc0a830993 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -55,6 +55,7 @@ void mi_cmd_disassemble (char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); + struct ui_out *uiout = current_uiout; CORE_ADDR start; int mode, disasm_flags; diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index ad34aacf569..9676e836d8f 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -69,6 +69,8 @@ env_execute_cli_command (const char *cmd, const char *args) void mi_cmd_env_pwd (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; + if (argc > 0) error (_("-environment-pwd: No arguments required")); @@ -112,6 +114,7 @@ env_mod_path (char *dirname, char **which_path) void mi_cmd_env_path (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; char *exec_path; char *env; int reset = 0; @@ -185,6 +188,7 @@ mi_cmd_env_path (char *command, char **argv, int argc) void mi_cmd_env_dir (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; int i; int optind = 0; int reset = 0; @@ -257,7 +261,8 @@ mi_cmd_inferior_tty_show (char *command, char **argv, int argc) error (_("-inferior-tty-show: Usage: No args")); if (inferior_io_terminal) - ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal); + ui_out_field_string (current_uiout, + "inferior_tty_terminal", inferior_io_terminal); } void diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 0150ca07d4b..22cb99532a8 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -34,6 +34,7 @@ void mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) { struct symtab_and_line st; + struct ui_out *uiout = current_uiout; if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv)) error (_("-file-list-exec-source-file: Usage: No args")); @@ -67,6 +68,8 @@ static void print_partial_file_name (const char *filename, const char *fullname, void *ignore) { + struct ui_out *uiout = current_uiout; + ui_out_begin (uiout, ui_out_type_tuple, NULL); ui_out_field_string (uiout, "file", filename); @@ -80,6 +83,7 @@ print_partial_file_name (const char *filename, const char *fullname, void mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct symtab *s; struct objfile *objfile; diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index ad2085115b6..ccd6b04afc1 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -78,7 +78,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc) if (fi == NULL) error (_("-stack-list-frames: Not enough frames in stack.")); - cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack"); + cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack"); /* Now let;s print the frames up to frame_high, or until there are frames in the stack. */ @@ -117,7 +117,7 @@ mi_cmd_stack_info_depth (char *command, char **argv, int argc) i++, fi = get_prev_frame (fi)) QUIT; - ui_out_field_int (uiout, "depth", i); + ui_out_field_int (current_uiout, "depth", i); } static enum print_values @@ -166,6 +166,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc) struct frame_info *fi; struct cleanup *cleanup_stack_args; enum print_values print_values; + struct ui_out *uiout = current_uiout; if (argc < 1 || argc > 3 || argc == 2) error (_("-stack-list-arguments: Usage: " @@ -249,6 +250,7 @@ list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi) static struct ui_stream *stb = NULL; struct type *type; char *name_of_result; + struct ui_out *uiout = current_uiout; stb = ui_out_stream_new (uiout); diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index aee6224a99a..c50f8631ed4 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -51,6 +51,7 @@ static void print_varobj (struct varobj *var, enum print_values print_values, int print_expression) { + struct ui_out *uiout = current_uiout; char *type; int thread_id; char *display_hint; @@ -98,6 +99,7 @@ print_varobj (struct varobj *var, enum print_values print_values, void mi_cmd_var_create (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; CORE_ADDR frameaddr = 0; struct varobj *var; char *name; @@ -167,6 +169,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc) int numdel; int children_only_p = 0; struct cleanup *old_cleanups; + struct ui_out *uiout = current_uiout; if (argc < 1 || argc > 2) error (_("-var-delete: Usage: [-c] EXPRESSION.")); @@ -244,6 +247,7 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) enum varobj_display_formats format; struct varobj *var; char *val; + struct ui_out *uiout = current_uiout; if (argc != 2) error (_("-var-set-format: Usage: NAME FORMAT.")); @@ -310,6 +314,7 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc) void mi_cmd_var_show_format (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; enum varobj_display_formats format; struct varobj *var; @@ -328,6 +333,7 @@ mi_cmd_var_show_format (char *command, char **argv, int argc) void mi_cmd_var_info_num_children (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; if (argc != 1) @@ -394,6 +400,7 @@ mi_print_value_p (struct varobj *var, enum print_values print_values) void mi_cmd_var_list_children (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; VEC(varobj_p) *children; struct varobj *child; @@ -466,6 +473,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) void mi_cmd_var_info_type (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; if (argc != 1) @@ -480,6 +488,7 @@ mi_cmd_var_info_type (char *command, char **argv, int argc) void mi_cmd_var_info_path_expression (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; char *path_expr; @@ -497,6 +506,7 @@ mi_cmd_var_info_path_expression (char *command, char **argv, int argc) void mi_cmd_var_info_expression (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; enum varobj_languages lang; struct varobj *var; @@ -515,6 +525,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc) void mi_cmd_var_show_attributes (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; int attr; char *attstr; struct varobj *var; @@ -538,6 +549,7 @@ mi_cmd_var_show_attributes (char *command, char **argv, int argc) void mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; enum varobj_display_formats format; @@ -606,6 +618,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) void mi_cmd_var_assign (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct varobj *var; char *expression, *val; @@ -667,6 +680,7 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer) void mi_cmd_var_update (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct cleanup *cleanup; char *name; enum print_values print_values; @@ -722,6 +736,7 @@ static void varobj_update_one (struct varobj *var, enum print_values print_values, int explicit) { + struct ui_out *uiout = current_uiout; struct cleanup *cleanup = NULL; VEC (varobj_update_result) *changes; varobj_update_result *r; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 7358b7344e3..ac8c171b626 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -401,18 +401,18 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame) { int core; - if (uiout != mi_uiout) + if (current_uiout != mi_uiout) { /* The normal_stop function has printed frame information into CLI uiout, or some other non-MI uiout. There's no way we can extract proper fields from random uiout object, so we print the frame again. In practice, this can only happen when running a CLI command in MI. */ - struct ui_out *saved_uiout = uiout; + struct ui_out *saved_uiout = current_uiout; - uiout = mi_uiout; + current_uiout = mi_uiout; print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC); - uiout = saved_uiout; + current_uiout = saved_uiout; } ui_out_field_int (mi_uiout, "thread-id", diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 1634778a497..04a1c979103 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -117,7 +117,7 @@ mi_cmd_gdb_exit (char *command, char **argv, int argc) if (current_token) fputs_unfiltered (current_token, raw_stdout); fputs_unfiltered ("^exit\n", raw_stdout); - mi_out_put (uiout, raw_stdout); + mi_out_put (current_uiout, raw_stdout); gdb_flush (raw_stdout); /* FIXME: The function called is not yet a formal libgdb function. */ quit_force (NULL, FROM_TTY); @@ -470,7 +470,7 @@ mi_cmd_thread_select (char *command, char **argv, int argc) if (argc != 1) error (_("-thread-select: USAGE: threadnum.")); - rc = gdb_thread_select (uiout, argv[0], &mi_error_message); + rc = gdb_thread_select (current_uiout, argv[0], &mi_error_message); if (rc == GDB_RC_FAIL) { @@ -488,7 +488,7 @@ mi_cmd_thread_list_ids (char *command, char **argv, int argc) if (argc != 0) error (_("-thread-list-ids: No arguments required.")); - rc = gdb_list_thread_ids (uiout, &mi_error_message); + rc = gdb_list_thread_ids (current_uiout, &mi_error_message); if (rc == GDB_RC_FAIL) { @@ -503,7 +503,7 @@ mi_cmd_thread_info (char *command, char **argv, int argc) if (argc != 0 && argc != 1) error (_("Invalid MI command")); - print_thread_info (uiout, argv[0], -1); + print_thread_info (current_uiout, argv[0], -1); } struct collect_cores_data @@ -550,6 +550,7 @@ static int print_one_inferior (struct inferior *inferior, void *xdata) { struct print_one_inferior_data *top_data = xdata; + struct ui_out *uiout = current_uiout; if (VEC_empty (int, top_data->inferiors) || bsearch (&(inferior->pid), VEC_address (int, top_data->inferiors), @@ -670,6 +671,7 @@ list_available_thread_groups (VEC (int) *ids, int recurse) struct osdata *data; struct osdata_item *item; int ix_items; + struct ui_out *uiout = current_uiout; /* This keeps a map from integer (pid) to VEC (struct osdata_item *)* The vector contains information about all threads for the given pid. @@ -787,6 +789,7 @@ list_available_thread_groups (VEC (int) *ids, int recurse) void mi_cmd_list_thread_groups (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct cleanup *back_to; int available = 0; int recurse = 0; @@ -889,6 +892,7 @@ void mi_cmd_data_list_register_names (char *command, char **argv, int argc) { struct gdbarch *gdbarch; + struct ui_out *uiout = current_uiout; int regnum, numregs; int i; struct cleanup *cleanup; @@ -940,6 +944,7 @@ void mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) { static struct regcache *this_regs = NULL; + struct ui_out *uiout = current_uiout; struct regcache *prev_regs; struct gdbarch *gdbarch; int regnum, numregs, changed; @@ -1044,6 +1049,7 @@ register_changed_p (int regnum, struct regcache *prev_regs, void mi_cmd_data_list_register_values (char *command, char **argv, int argc) { + struct ui_out *uiout = current_uiout; struct frame_info *frame; struct gdbarch *gdbarch; int regnum, numregs, format; @@ -1110,6 +1116,7 @@ static void get_register (struct frame_info *frame, int regnum, int format) { struct gdbarch *gdbarch = get_frame_arch (frame); + struct ui_out *uiout = current_uiout; CORE_ADDR addr; enum lval_type lval; static struct ui_stream *stb = NULL; @@ -1229,6 +1236,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) struct value *val; struct ui_stream *stb = NULL; struct value_print_options opts; + struct ui_out *uiout = current_uiout; stb = ui_out_stream_new (uiout); @@ -1279,6 +1287,7 @@ void mi_cmd_data_read_memory (char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); + struct ui_out *uiout = current_uiout; struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); CORE_ADDR addr; long total_bytes; @@ -1470,6 +1479,7 @@ void mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc) { struct gdbarch *gdbarch = get_current_arch (); + struct ui_out *uiout = current_uiout; struct cleanup *cleanups; CORE_ADDR addr; LONGEST length; @@ -1702,6 +1712,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) if (argc == 0) { struct cleanup *cleanup = NULL; + struct ui_out *uiout = current_uiout; cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features"); ui_out_field_string (uiout, NULL, "frozen-varobjs"); @@ -1727,6 +1738,7 @@ mi_cmd_list_target_features (char *command, char **argv, int argc) if (argc == 0) { struct cleanup *cleanup = NULL; + struct ui_out *uiout = current_uiout; cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features"); if (target_can_async_p ()) @@ -1751,7 +1763,7 @@ mi_cmd_add_inferior (char *command, char **argv, int argc) inf = add_inferior_with_spaces (); - ui_out_field_fmt (uiout, "inferior", "i%d", inf->num); + ui_out_field_fmt (current_uiout, "inferior", "i%d", inf->num); } /* Callback used to find the first inferior other than the @@ -1958,14 +1970,14 @@ mi_execute_command (char *cmd, int from_tty) TRY_CATCH (result, RETURN_MASK_ALL) { - captured_mi_execute_command (uiout, command); + captured_mi_execute_command (current_uiout, command); } if (result.reason < 0) { /* The command execution failed and error() was called somewhere. */ mi_print_exception (command->token, result); - mi_out_rewind (uiout); + mi_out_rewind (current_uiout); } bpstat_do_actions (); @@ -2177,22 +2189,25 @@ mi_load_progress (const char *section_name, static char *previous_sect_name = NULL; int new_section; struct ui_out *saved_uiout; + struct ui_out *uiout; /* This function is called through deprecated_show_load_progress which means uiout may not be correct. Fix it for the duration of this function. */ - saved_uiout = uiout; + saved_uiout = current_uiout; if (current_interp_named_p (INTERP_MI) || current_interp_named_p (INTERP_MI2)) - uiout = mi_out_new (2); + current_uiout = mi_out_new (2); else if (current_interp_named_p (INTERP_MI1)) - uiout = mi_out_new (1); + current_uiout = mi_out_new (1); else if (current_interp_named_p (INTERP_MI3)) - uiout = mi_out_new (3); + current_uiout = mi_out_new (3); else return; + uiout = current_uiout; + update_threshold.tv_sec = 0; update_threshold.tv_usec = 500000; gettimeofday (&time_now, NULL); diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 17ff8c361ab..81f2da1bc55 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -37,6 +37,7 @@ mi_cmd_symbol_list_lines (char *command, char **argv, int argc) struct symtab *s; int i; struct cleanup *cleanup_stack, *cleanup_tuple; + struct ui_out *uiout = current_uiout; if (argc != 1) error (_("-symbol-list-lines: Usage: SOURCE_FILENAME")); diff --git a/gdb/osdata.c b/gdb/osdata.c index 024d8f41315..c3da23a7104 100644 --- a/gdb/osdata.c +++ b/gdb/osdata.c @@ -291,6 +291,7 @@ get_osdata_column (struct osdata_item *item, const char *name) static void info_osdata_command (char *type, int from_tty) { + struct ui_out *uiout = current_uiout; struct osdata *osdata = NULL; struct osdata_item *last; struct cleanup *old_chain; diff --git a/gdb/progspace.c b/gdb/progspace.c index 9f32cef6ec9..2d0dce71f63 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -397,7 +397,7 @@ maintenance_info_program_spaces_command (char *args, int from_tty) error (_("program space ID %d not known."), requested); } - print_program_space (uiout, requested); + print_program_space (current_uiout, requested); } /* Simply returns the count of program spaces. */ diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 619d9953f18..158b1cbfe22 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -494,6 +494,7 @@ collect_matching_scripts (void **slot, void *info) static void print_script (struct loaded_script *script) { + struct ui_out *uiout = current_uiout; struct cleanup *chain; chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); @@ -530,6 +531,7 @@ sort_scripts_by_name (const void *ap, const void *bp) static void info_auto_load_scripts (char *pattern, int from_tty) { + struct ui_out *uiout = current_uiout; struct auto_load_pspace_info *pspace_info; struct cleanup *script_chain; VEC (loaded_script_ptr) *scripts; diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 448c95db511..126957cf5bd 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -492,12 +492,12 @@ bppy_get_commands (PyObject *self, void *closure) string_file = mem_fileopen (); chain = make_cleanup_ui_file_delete (string_file); - ui_out_redirect (uiout, string_file); + ui_out_redirect (current_uiout, string_file); TRY_CATCH (except, RETURN_MASK_ALL) { - print_command_lines (uiout, breakpoint_commands (bp), 0); + print_command_lines (current_uiout, breakpoint_commands (bp), 0); } - ui_out_redirect (uiout, NULL); + ui_out_redirect (current_uiout, NULL); GDB_PY_HANDLE_EXCEPTION (except); cmdstr = ui_file_xstrdup (string_file, &length); diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index d840c56bd61..1c5478aaa14 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -1416,7 +1416,8 @@ remote_fileio_request (char *buf, int ctrlc_pending_p) remote_fio_ctrl_c_flag = 0; remote_fio_no_longjmp = 0; - ex = catch_exceptions (uiout, do_remote_fileio_request, (void *)buf, + ex = catch_exceptions (current_uiout, + do_remote_fileio_request, (void *)buf, RETURN_MASK_ALL); switch (ex) { diff --git a/gdb/remote.c b/gdb/remote.c index b17cb50b92d..fd4852fa2ec 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10541,6 +10541,7 @@ show_remote_cmd (char *args, int from_tty) the redundant "show remote Z-packet" and the legacy aliases. */ struct cleanup *showlist_chain; struct cmd_list_element *list = remote_show_cmdlist; + struct ui_out *uiout = current_uiout; showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist"); for (; list != NULL; list = list->next) diff --git a/gdb/solib.c b/gdb/solib.c index 49c1cdbfd64..3296ed4f1ae 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1009,6 +1009,7 @@ info_sharedlibrary_command (char *pattern, int from_tty) int nr_libs; struct cleanup *table_cleanup; struct gdbarch *gdbarch = target_gdbarch; + struct ui_out *uiout = current_uiout; if (pattern) { diff --git a/gdb/source.c b/gdb/source.c index 70890e150d4..d01dff4e538 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1277,6 +1277,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, int noerror) FILE *stream; int nlines = stopline - line; struct cleanup *cleanup; + struct ui_out *uiout = current_uiout; /* Regardless of whether we can open the file, set current_source_symtab. */ current_source_symtab = s; diff --git a/gdb/stack.c b/gdb/stack.c index 0e056e1d4ac..4e050fc9893 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -119,7 +119,7 @@ print_stack_frame (struct frame_info *frame, int print_level, volatile struct gdb_exception e; /* For mi, alway print location and address. */ - if (ui_out_is_mi_like_p (uiout)) + if (ui_out_is_mi_like_p (current_uiout)) print_what = LOC_AND_ADDRESS; TRY_CATCH (e, RETURN_MASK_ERROR) @@ -175,6 +175,7 @@ static void print_frame_args (struct symbol *func, struct frame_info *frame, int num, struct ui_file *stream) { + struct ui_out *uiout = current_uiout; int first = 1; /* Offset of next stack argument beyond the one we have seen that is at the highest offset, or -1 if we haven't come to a stack @@ -436,8 +437,9 @@ do_gdb_disassembly (struct gdbarch *gdbarch, TRY_CATCH (exception, RETURN_MASK_ERROR) { - gdb_disassembly (gdbarch, uiout, 0, DISASSEMBLY_RAW_INSN, how_many, low, - high); + gdb_disassembly (gdbarch, current_uiout, 0, + DISASSEMBLY_RAW_INSN, how_many, + low, high); } if (exception.reason < 0) { @@ -466,6 +468,7 @@ print_frame_info (struct frame_info *frame, int print_level, struct symtab_and_line sal; int source_print; int location_print; + struct ui_out *uiout = current_uiout; if (get_frame_type (frame) == DUMMY_FRAME || get_frame_type (frame) == SIGTRAMP_FRAME @@ -698,6 +701,7 @@ print_frame (struct frame_info *frame, int print_level, struct symtab_and_line sal) { struct gdbarch *gdbarch = get_frame_arch (frame); + struct ui_out *uiout = current_uiout; char *funname = NULL; enum language funlang = language_unknown; struct ui_stream *stb; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index bef28c7ccfa..c513e0efbac 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -205,7 +205,7 @@ add_vsyscall_page (struct target_ops *target, int from_tty) vsyscall DSO was not triggered by the user, even if the user typed "run" at the TTY. */ args.from_tty = 0; - catch_exceptions (uiout, symbol_file_add_from_memory_wrapper, + catch_exceptions (current_uiout, symbol_file_add_from_memory_wrapper, &args, RETURN_MASK_ALL); } } diff --git a/gdb/symfile.c b/gdb/symfile.c index 4689e0e3103..aca907aeade 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1864,7 +1864,7 @@ load_progress (ULONGEST bytes, void *untyped_arg) { /* The write is just starting. Let the user know we've started this section. */ - ui_out_message (uiout, 0, "Loading section %s, size %s lma %s\n", + ui_out_message (current_uiout, 0, "Loading section %s, size %s lma %s\n", args->section_name, hex_string (args->section_size), paddress (target_gdbarch, args->lma)); return; @@ -1976,6 +1976,7 @@ generic_load (char *args, int from_tty) struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); struct load_section_data cbdata; struct load_progress_data total_progress; + struct ui_out *uiout = current_uiout; CORE_ADDR entry; char **argv; @@ -2103,6 +2104,7 @@ print_transfer_performance (struct ui_file *stream, const struct timeval *end_time) { ULONGEST time_count; + struct ui_out *uiout = current_uiout; /* Compute the elapsed time in milliseconds, as a tradeoff between accuracy and overflow. */ diff --git a/gdb/thread.c b/gdb/thread.c index 5a78ad17025..ceeaa99533f 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -971,7 +971,7 @@ No selected thread. See `help thread'.\n"); static void info_threads_command (char *arg, int from_tty) { - print_thread_info (uiout, arg, -1); + print_thread_info (current_uiout, arg, -1); } /* Switch from one thread to another. */ @@ -1063,7 +1063,7 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level) select_frame (get_current_frame ()); /* Warn the user. */ - if (frame_level > 0 && !ui_out_is_mi_like_p (uiout)) + if (frame_level > 0 && !ui_out_is_mi_like_p (current_uiout)) { warning (_("Couldn't restore frame #%d in " "current thread, at reparsed frame #0\n"), @@ -1292,7 +1292,7 @@ thread_command (char *tidstr, int from_tty) return; } - gdb_thread_select (uiout, tidstr, NULL); + gdb_thread_select (current_uiout, tidstr, NULL); } /* Implementation of `thread name'. */ diff --git a/gdb/top.c b/gdb/top.c index 8dba0e086b3..7b98353de54 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -504,10 +504,10 @@ execute_command_to_string (char *p, int from_tty) make_cleanup_restore_ui_file (&gdb_stdtarg); make_cleanup_restore_ui_file (&gdb_stdtargerr); - if (ui_out_redirect (uiout, str_file) < 0) + if (ui_out_redirect (current_uiout, str_file) < 0) warning (_("Current output protocol does not support redirection")); else - make_cleanup_ui_out_redirect_pop (uiout); + make_cleanup_ui_out_redirect_pop (current_uiout); gdb_stdout = str_file; gdb_stderr = str_file; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 8b4e5f56e91..351cbb2b41b 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -457,6 +457,7 @@ tvariables_info_1 (void) int ix; int count = 0; struct cleanup *back_to; + struct ui_out *uiout = current_uiout; if (VEC_length (tsv_s, tvariables) == 0 && !ui_out_is_mi_like_p (uiout)) { @@ -1811,6 +1812,7 @@ trace_status_command (char *args, int from_tty) void trace_status_mi (int on_stop) { + struct ui_out *uiout = current_uiout; struct trace_status *ts = current_trace_status (); int status; @@ -1950,6 +1952,7 @@ tfind_1 (enum trace_find_type type, int num, int target_frameno = -1, target_tracept = -1; struct frame_id old_frame_id = null_frame_id; struct tracepoint *tp; + struct ui_out *uiout = current_uiout; /* Only try to get the current stack frame if we have a chance of succeeding. In particular, if we're trying to get a first trace @@ -4366,6 +4369,7 @@ print_one_static_tracepoint_marker (int count, char wrap_indent[80]; char extra_field_indent[80]; + struct ui_out *uiout = current_uiout; struct ui_stream *stb = ui_out_stream_new (uiout); struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb); struct cleanup *bkpt_chain; @@ -4483,6 +4487,7 @@ info_static_tracepoint_markers_command (char *arg, int from_tty) VEC(static_tracepoint_marker_p) *markers; struct cleanup *old_chain; struct static_tracepoint_marker *marker; + struct ui_out *uiout = current_uiout; int i; old_chain diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 919d1ac4ba3..2f0dd3d4366 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -178,10 +178,10 @@ tui_command_loop (void *data) preserves the uiout from changing, this must be done at top level of event loop. */ if (tui_active) - uiout = tui_out; + current_uiout = tui_out; else - uiout = tui_old_uiout; - + current_uiout = tui_old_uiout; + if (result == 0) { /* If any exception escaped to here, we better enable diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index afcd9f96c77..5fcb39540fb 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -530,7 +530,7 @@ tui_setup_io (int mode) /* Keep track of previous gdb output. */ tui_old_stdout = gdb_stdout; tui_old_stderr = gdb_stderr; - tui_old_uiout = uiout; + tui_old_uiout = current_uiout; /* Reconfigure gdb output. */ gdb_stdout = tui_stdout; @@ -538,7 +538,7 @@ tui_setup_io (int mode) gdb_stdlog = gdb_stdout; /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ gdb_stdtargerr = gdb_stderr; /* for moment */ - uiout = tui_out; + current_uiout = tui_out; /* Save tty for SIGCONT. */ savetty (); @@ -551,7 +551,7 @@ tui_setup_io (int mode) gdb_stdlog = gdb_stdout; /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ gdb_stdtargerr = gdb_stderr; /* for moment */ - uiout = tui_old_uiout; + current_uiout = tui_old_uiout; /* Restore readline. */ rl_redisplay_function = tui_old_rl_redisplay_function; @@ -607,7 +607,7 @@ tui_initialize_io (void) /* Create the default UI. It is not created because we installed a deprecated_init_ui_hook. */ - tui_old_uiout = uiout = cli_out_new (gdb_stdout); + tui_old_uiout = current_uiout = cli_out_new (gdb_stdout); #ifdef TUI_USE_PIPE_FOR_READLINE /* Temporary solution for readline writing to stdout: redirect diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 2994828da2f..b821719a11c 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -222,7 +222,7 @@ struct ui_out def_uiout = /* FIXME: This should not be a global, but something passed down from main.c or top.c. */ -struct ui_out *uiout = &def_uiout; +struct ui_out *current_uiout = &def_uiout; /* These are the interfaces to implementation functions. */ diff --git a/gdb/ui-out.h b/gdb/ui-out.h index b0fddd85399..c86cb4cb23b 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -33,7 +33,7 @@ struct ui_file; /* FIXME: This should not be a global but something passed down from main.c or top.c. */ -extern struct ui_out *uiout; +extern struct ui_out *current_uiout; /* alignment enum */ enum ui_align |