This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Class-ify ui_out
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 22 Dec 2016 21:20:42 -0000
- Subject: [binutils-gdb] Class-ify ui_out
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=112e8700a6fd2fed65ca70132c9cbed4132e8bd4
commit 112e8700a6fd2fed65ca70132c9cbed4132e8bd4
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Thu Dec 22 16:17:31 2016 -0500
Class-ify ui_out
This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy. ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.
In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.
It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...
gdb/ChangeLog:
* ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int,
ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
Remove, replace with a method in class ui_out.
(table_begin_ftype): Remove, replace with pure virtual method in
class ui_out.
(table_body_ftype): Likewise.
(table_end_ftype): Likewise.
(table_header_ftype): Likewise.
(ui_out_begin_ftype): Likewise.
(ui_out_end_ftype): Likewise.
(field_int_ftype): Likewise.
(field_skip_ftype): Likewise.
(field_string_ftype): Likewise.
(field_fmt_ftype): Likewise.
(spaces_ftype): Likewise.
(text_ftype): Likewise.
(message_ftype): Likewise.
(wrap_hint_ftype): Likewise.
(flush_ftype): Likewise.
(redirect_ftype): Likewise.
(data_destroy_ftype): Likewise.
(struct ui_out_impl): Remove, replace with class ui_out.
(ui_out_new): Remove.
(class ui_out): New class.
* ui-out.c (struct ui_out): Remove, replaced with class ui_out.
(current_level): Remove, replace with ui_out method.
(push_level): Likewise.
(pop_level): Likewise.
(uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
uo_redirect, uo_field_string): Remove.
(ui_out_table_begin): Replace with ...
(ui_out::table_begin): ... this.
(ui_out_table_body): Replace with ...
(ui_out::table_body): ... this.
(ui_out_table_end): Replace with ...
(ui_out::table_end): ... this.
(ui_out_table_header): Replace with ...
(ui_out::table_header): ... this.
(ui_out_begin): Replace with ...
(ui_out::begin): ... this.
(ui_out_end): Replace with ...
(ui_out::end): ... this.
(ui_out_field_int): Replace with ...
(ui_out::field_int): ... this.
(ui_out_field_fmt_int): Replace with ...
(ui_out::field_fmt_int): ... this.
(ui_out_field_core_addr): Replace with ...
(ui_out::field_core_addr): ... this.
(ui_out_field_stream): Replace with ...
(ui_out::field_stream): ... this.
(ui_out_field_skip): Replace with ...
(ui_out::field_skip): ... this.
(ui_out_field_string): Replace with ...
(ui_out::field_string): ... this.
(ui_out_field_fmt): Replace with ...
(ui_out::field_fmt): ... this.
(ui_out_spaces): Replace with ...
(ui_out::spaces): ... this.
(ui_out_text): Replace with ...
(ui_out::text): ... this.
(ui_out_message): Replace with ...
(ui_out::message): ... this.
(ui_out_wrap_hint): Replace with ...
(ui_out::wrap_hint): ... this.
(ui_out_flush): Replace with ...
(ui_out::flush): ... this.
(ui_out_redirect): Replace with ...
(ui_out::redirect): ... this.
(ui_out_test_flags): Replace with ...
(ui_out::test_flags): ... this.
(ui_out_is_mi_like_p): Replace with ...
(ui_out::is_mi_like_p): ... this.
(verify_field): Replace with ...
(ui_out::verify_field): ... this.
(ui_out_query_field): Replace with ...
(ui_out::query_table_field): ... this.
(ui_out_data): Remove.
(ui_out_new): Remove, replace with ...
(ui_out::ui_out): ... this constructor.
(do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Update fallouts of struct
ui_out -> class ui_out change.
* cli-out.c (cli_out_data): Remove.
(cli_uiout_dtor): Remove.
(cli_table_begin): Replace with ...
(cli_ui_out::do_table_begin): ... this new method.
(cli_table_body): Replace with ...
(cli_ui_out::do_table_body): ... this new method.
(cli_table_end): Replace with ...
(cli_ui_out::do_table_end): ... this new method.
(cli_table_header): Replace with ...
(cli_ui_out::do_table_header): ... this new method.
(cli_begin): Replace with ...
(cli_ui_out::do_begin): ... this new method.
(cli_end): Replace with ...
(cli_ui_out::do_end): ... this new method.
(cli_field_int): Replace with ...
(cli_ui_out::do_field_int): ... this new method.
(cli_field_skip): Replace with ...
(cli_ui_out::do_field_skip): ... this new method.
(cli_field_string): Replace with ...
(cli_ui_out::do_field_string): ... this new method.
(cli_field_fmt): Replace with ...
(cli_ui_out::do_field_fmt): ... this new method.
(cli_spaces): Replace with ...
(cli_ui_out::do_spaces): ... this new method.
(cli_text): Replace with ...
(cli_ui_out::do_text): ... this new method.
(cli_message): Replace with ...
(cli_ui_out::do_message): ... this new method.
(cli_wrap_hint): Replace with ...
(cli_ui_out::do_wrap_hint): ... this new method.
(cli_flush): Replace with ...
(cli_ui_out::do_flush): ... this new method.
(cli_redirect): Replace with ...
(cli_ui_out::do_redirect): ... this new method.
(out_field_fmt): Replace with ...
(cli_ui_out::out_field_fmt): ... this new method.
(field_separator): Replace with ...
(cli_ui_out::field_separator): ... this new method.
(cli_out_set_stream): Replace with ...
(cli_ui_out::set_stream): ... this new method.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_ui_out_impl::cli_ui_out_impl): New constructor.
(cli_ui_out_impl::~cli_ui_out_impl): New destructor.
(cli_out_new): Change return type to cli_ui_out *, instantiate a
cli_ui_out.
* cli-out.h (cli_ui_out_data): Remove, replace with class
cli_ui_out.
(class cli_ui_out): New class.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_out_new): Change return type to cli_ui_out*.
(cli_out_set_stream): Remove.
* cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
to cli_ui_out*.
(cli_interpreter_resume): Adapt.
(cli_interpreter_exec): Adapt.
* mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
(mi_ui_out_impl): Remove.
(mi_table_begin): Replace with ...
(mi_ui_out::do_table_begin): ... this.
(mi_table_body): Replace with ...
(mi_ui_out::do_table_body): ... this.
(mi_table_end): Replace with ...
(mi_ui_out::do_table_end): ... this.
(mi_table_header): Replace with ...
(mi_ui_out::do_table_header): ... this.
(mi_begin): Replace with ...
(mi_ui_out::do_begin): ... this.
(mi_end): Replace with ...
(mi_ui_out::do_end): ... this.
(mi_field_int): Replace with ...
(mi_ui_out::do_field_int): ... this.
(mi_field_skip): Replace with ...
(mi_ui_out::do_field_skip): ... this.
(mi_field_string): Replace with ...
(mi_ui_out::do_field_string): ... this.
(mi_field_fmt): Replace with ...
(mi_ui_out::do_field_fmt): ... this.
(mi_spaces): Replace with ...
(mi_ui_out::do_spaces): ... this.
(mi_text): Replace with ...
(mi_ui_out::do_text): ... this.
(mi_message): Replace with ...
(mi_ui_out::do_message): ... this.
(mi_wrap_hint): Replace with ...
(mi_ui_out::do_wrap_hint): ... this.
(mi_flush): Replace with ...
(mi_ui_out::do_flush): ... this.
(mi_redirect): Replace with ...
(mi_ui_out::do_redirect):
(field_separator): Replace with ...
(mi_ui_out::field_separator):
(mi_open): Replace with ...
(mi_ui_out::open): ... this.
(mi_close): Replace with ...
(mi_ui_out::close): ... this.
(mi_out_rewind): Replace with ...
(mi_ui_out::rewind): ... this.
(mi_out_put): Replace with ...
(mi_ui_out::put): ... this.
(mi_version): Replace with ...
(mi_ui_out::version): ... this.
(mi_out_data_ctor): Replace with ...
(mi_ui_out::mi_ui_out): ... this.
(mi_out_data_dtor): Replace with ...
(mi_ui_out::~mi_ui_out): ... this.
(mi_out_new): Change return type to mi_ui_out*, instantiate
an mi_ui_out object.
(as_mi_ui_out): New function.
(mi_version): Update fallouts of struct ui_out to class ui_out
transition.
(mi_out_put): Likewise.
(mi_out_rewind): Likewise.
* mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
* tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
Remove.
(tui_field_int): Replace with ...
(tui_ui_out::do_field_int): ... this.
(tui_field_string): Replace with ...
(tui_ui_out::do_field_string): ... this.
(tui_field_fmt): Replace with ...
(tui_ui_out::do_field_fmt): ... this.
(tui_text): Replace with ...
(tui_ui_out::do_text): ... this.
(tui_out_new): Change return type to tui_ui_out*, instantiate
tui_ui_out object.
(tui_ui_out::tui_ui_out): New.
* tui/tui-out.h: New file.
* tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
* tui/tui-io.c: Include tui/tui-out.h.
(tui_old_uiout): Change type to cli_ui_out*.
(tui_setup_io): Use dynamic_cast.
* tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
* tui/tui-interp.c (tui_resume): Adapt.
* ada-lang.c (print_it_exception): Update fallouts of struct
ui_out to class ui_out transition.
(print_one_exception): Likewise.
(print_mention_exception): Likewise.
* ada-tasks.c (print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command): Likewise.
* auto-load.c (print_script): Likewise.
(auto_load_info_scripts): Likewise.
(info_auto_load_cmd): Likewise.
* break-catch-sig.c (signal_catchpoint_print_one): Likewise.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
(print_one_catch_syscall): Likewise.
* break-catch-throw.c (print_it_exception_catchpoint): Likewise.
(print_one_exception_catchpoint): Likewise.
(print_one_detail_exception_catchpoint): Likewise.
(print_mention_exception_catchpoint): Likewise.
* breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
(print_solib_event): Likewise.
(watchpoint_check): Likewise.
(wrap_indent_at_field): Likewise.
(print_breakpoint_location): Likewise.
(output_thread_groups): Likewise.
(print_one_breakpoint_location): Likewise.
(breakpoint_1): Likewise.
(default_collect_info): Likewise.
(watchpoints_info): Likewise.
(print_it_catch_fork): Likewise.
(print_one_catch_fork): Likewise.
(print_it_catch_vfork): Likewise.
(print_one_catch_vfork): Likewise.
(print_it_catch_solib): Likewise.
(print_one_catch_solib): Likewise.
(print_it_catch_exec): Likewise.
(print_one_catch_exec): Likewise.
(mention): Likewise.
(print_it_ranged_breakpoint): Likewise.
(print_one_ranged_breakpoint): Likewise.
(print_one_detail_ranged_breakpoint): Likewise.
(print_mention_ranged_breakpoint): Likewise.
(print_it_watchpoint): Likewise.
(print_mention_watchpoint): Likewise.
(print_it_masked_watchpoint): Likewise.
(print_one_detail_masked_watchpoint): Likewise.
(print_mention_masked_watchpoint): Likewise.
(bkpt_print_it): Likewise.
(tracepoint_print_one_detail): Likewise.
(tracepoint_print_mention): Likewise.
(update_static_tracepoint): Likewise.
(tracepoints_info): Likewise.
(save_breakpoints): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
* cli/cli-logging.c (set_logging_redirect): Likewise.
(pop_output_files): Likewise.
(handle_redirections): Likewise.
* cli/cli-script.c (print_command_lines): Likewise.
* cli/cli-setshow.c (do_show_command): Likewise.
(cmd_show_list): Likewise.
* cp-abi.c (list_cp_abis): Likewise.
(show_cp_abi_cmd): Likewise.
* darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
* disasm.c (gdb_pretty_print_insn): Likewise.
(do_mixed_source_and_assembly_deprecated): Likewise.
(do_mixed_source_and_assembly): Likewise.
* gdb_bfd.c (print_one_bfd): Likewise.
(maintenance_info_bfds): Likewise.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
* i386-tdep.c (i386_mpx_print_bounds): Likewise.
* infcmd.c (run_command_1): Likewise.
(print_return_value_1): Likewise.
* inferior.c (print_selected_inferior): Likewise.
(print_inferior): Likewise.
* infrun.c (print_end_stepping_range_reason): Likewise.
(print_signal_exited_reason): Likewise.
(print_exited_reason): Likewise.
(print_signal_received_reason): Likewise.
(print_no_history_reason): Likewise.
* interps.c (interp_set): Likewise.
* linespec.c (decode_line_full): Likewise.
* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
(mi_cmd_env_path): Likewise.
(mi_cmd_env_dir): Likewise.
(mi_cmd_inferior_tty_show): Likewise.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
(print_partial_file_name): Likewise.
(mi_cmd_file_list_exec_source_files): Likewise.
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
(mi_cmd_info_gdb_mi_command): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
(mi_cmd_stack_list_args): Likewise.
(list_arg_or_local): Likewise.
* mi/mi-cmd-var.c (print_varobj): Likewise.
(mi_cmd_var_create): Likewise.
(mi_cmd_var_delete): Likewise.
(mi_cmd_var_set_format): Likewise.
(mi_cmd_var_show_format): Likewise.
(mi_cmd_var_info_num_children): Likewise.
(mi_cmd_var_list_children): Likewise.
(mi_cmd_var_info_type): Likewise.
(mi_cmd_var_info_path_expression): Likewise.
(mi_cmd_var_info_expression): Likewise.
(mi_cmd_var_show_attributes): Likewise.
(mi_cmd_var_evaluate_expression): Likewise.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise.
* mi/mi-interp.c (as_mi_interp): Likewise.
(mi_on_normal_stop_1): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(mi_user_selected_context_changed): Likewise.
* mi/mi-main.c (print_one_inferior): Likewise.
(output_cores): Likewise.
(list_available_thread_groups): Likewise.
(mi_cmd_data_list_register_names): Likewise.
(mi_cmd_data_list_changed_registers): Likewise.
(output_register): Likewise.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_list_features): Likewise.
(mi_cmd_list_target_features): Likewise.
(mi_cmd_add_inferior): Likewise.
(mi_execute_command): Likewise.
(mi_load_progress): Likewise.
(print_variable_or_computed): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
* osdata.c (info_osdata_command): Likewise.
* probe.c (gen_ui_out_table_header_info): Likewise.
(print_ui_out_not_applicables): Likewise.
(print_ui_out_info): Likewise.
(info_probes_for_ops): Likewise.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
* progspace.c (print_program_space): Likewise.
* python/py-breakpoint.c (bppy_get_commands): Likewise.
* python/py-framefilter.c (py_print_type): Likewise.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Likewise.
(enumerate_locals): Likewise.
(py_print_args): Likewise.
(py_print_frame): Likewise.
* record-btrace.c (btrace_ui_out_decode_error): Likewise.
(btrace_call_history_insn_range): Likewise.
(btrace_call_history_src_line): Likewise.
(btrace_call_history): Likewise.
* remote.c (show_remote_cmd): Likewise.
* skip.c (skip_info): Likewise.
* solib.c (info_sharedlibrary_command): Likewise.
* source.c (print_source_lines_base): Likewise.
* spu-tdep.c (info_spu_event_command): Likewise.
(info_spu_signal_command): Likewise.
(info_spu_mailbox_list): Likewise.
(info_spu_dma_cmdlist): Likewise.
(info_spu_dma_command): Likewise.
(info_spu_proxydma_command): Likewise.
* stack.c (print_stack_frame): Likewise.
(print_frame_arg): Likewise.
(read_frame_arg): Likewise.
(print_frame_args): Likewise.
(print_frame_info): Likewise.
(print_frame): Likewise.
* symfile.c (load_progress): Likewise.
(generic_load): Likewise.
(print_transfer_performance): Likewise.
* thread.c (do_captured_list_thread_ids): Likewise.
(print_thread_info_1): Likewise.
(restore_selected_frame): Likewise.
(do_captured_thread_select): Likewise.
(print_selected_thread_frame): Likewise.
* top.c (execute_command_to_string): Likewise.
* tracepoint.c (tvariables_info_1): Likewise.
(trace_status_mi): Likewise.
(tfind_1): Likewise.
(print_one_static_tracepoint_marker): Likewise.
(info_static_tracepoint_markers_command): Likewise.
* utils.c (do_ui_out_redirect_pop): Likewise.
(fputs_maybe_filtered): Likewise.
Diff:
---
gdb/ChangeLog | 414 +++++++++++++++++++++++++++++++
gdb/ada-lang.c | 47 ++--
gdb/ada-tasks.c | 63 +++--
gdb/auto-load.c | 29 ++-
gdb/break-catch-sig.c | 16 +-
gdb/break-catch-syscall.c | 40 +--
gdb/break-catch-throw.c | 52 ++--
gdb/breakpoint.c | 591 +++++++++++++++++++++-----------------------
gdb/cli-out.c | 301 +++++++---------------
gdb/cli-out.h | 60 ++++-
gdb/cli/cli-cmds.c | 2 +-
gdb/cli/cli-interp.c | 12 +-
gdb/cli/cli-logging.c | 12 +-
gdb/cli/cli-script.c | 84 +++----
gdb/cli/cli-setshow.c | 14 +-
gdb/cp-abi.c | 22 +-
gdb/darwin-nat-info.c | 48 ++--
gdb/disasm.c | 51 ++--
gdb/gdb_bfd.c | 16 +-
gdb/guile/scm-breakpoint.c | 4 +-
gdb/guile/scm-ports.c | 2 +-
gdb/i386-linux-tdep.c | 25 +-
gdb/i386-tdep.c | 32 +--
gdb/infcmd.c | 32 +--
gdb/inferior.c | 39 +--
gdb/infrun.c | 95 ++++---
gdb/interps.c | 4 +-
gdb/linespec.c | 2 +-
gdb/linux-thread-db.c | 17 +-
gdb/mi/mi-cmd-env.c | 9 +-
gdb/mi/mi-cmd-file.c | 32 ++-
gdb/mi/mi-cmd-info.c | 12 +-
gdb/mi/mi-cmd-stack.c | 12 +-
gdb/mi/mi-cmd-var.c | 77 +++---
gdb/mi/mi-interp.c | 81 +++---
gdb/mi/mi-main.c | 149 ++++++-----
gdb/mi/mi-out.c | 309 +++++++++--------------
gdb/mi/mi-out.h | 69 +++++-
gdb/mi/mi-symbol-cmds.c | 5 +-
gdb/osdata.c | 10 +-
gdb/probe.c | 67 +++--
gdb/progspace.c | 20 +-
gdb/python/py-breakpoint.c | 6 +-
gdb/python/py-framefilter.c | 88 +++----
gdb/record-btrace.c | 44 ++--
gdb/remote.c | 4 +-
gdb/skip.c | 44 ++--
gdb/solib.c | 39 ++-
gdb/source.c | 31 ++-
gdb/spu-tdep.c | 124 +++++-----
gdb/stack.c | 84 +++----
gdb/symfile.c | 45 ++--
gdb/thread.c | 100 ++++----
gdb/top.c | 2 +-
gdb/tracepoint.c | 146 +++++------
gdb/tui/tui-interp.c | 6 +-
gdb/tui/tui-io.c | 6 +-
gdb/tui/tui-io.h | 3 +-
gdb/tui/tui-out.c | 143 ++++-------
gdb/tui/tui-out.h | 48 ++++
gdb/tui/tui.h | 2 -
gdb/ui-out.c | 503 ++++++++++---------------------------
gdb/ui-out.h | 268 +++++++++-----------
gdb/utils.c | 4 +-
64 files changed, 2341 insertions(+), 2377 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2041dd5..9f33d68 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,417 @@
+2016-12-22 Simon Marchi <simon.marchi@ericsson.com>
+
+ * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
+ ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int,
+ ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
+ ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
+ ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
+ ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
+ Remove, replace with a method in class ui_out.
+ (table_begin_ftype): Remove, replace with pure virtual method in
+ class ui_out.
+ (table_body_ftype): Likewise.
+ (table_end_ftype): Likewise.
+ (table_header_ftype): Likewise.
+ (ui_out_begin_ftype): Likewise.
+ (ui_out_end_ftype): Likewise.
+ (field_int_ftype): Likewise.
+ (field_skip_ftype): Likewise.
+ (field_string_ftype): Likewise.
+ (field_fmt_ftype): Likewise.
+ (spaces_ftype): Likewise.
+ (text_ftype): Likewise.
+ (message_ftype): Likewise.
+ (wrap_hint_ftype): Likewise.
+ (flush_ftype): Likewise.
+ (redirect_ftype): Likewise.
+ (data_destroy_ftype): Likewise.
+ (struct ui_out_impl): Remove, replace with class ui_out.
+ (ui_out_new): Remove.
+ (class ui_out): New class.
+ * ui-out.c (struct ui_out): Remove, replaced with class ui_out.
+ (current_level): Remove, replace with ui_out method.
+ (push_level): Likewise.
+ (pop_level): Likewise.
+ (uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
+ uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
+ uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
+ uo_redirect, uo_field_string): Remove.
+ (ui_out_table_begin): Replace with ...
+ (ui_out::table_begin): ... this.
+ (ui_out_table_body): Replace with ...
+ (ui_out::table_body): ... this.
+ (ui_out_table_end): Replace with ...
+ (ui_out::table_end): ... this.
+ (ui_out_table_header): Replace with ...
+ (ui_out::table_header): ... this.
+ (ui_out_begin): Replace with ...
+ (ui_out::begin): ... this.
+ (ui_out_end): Replace with ...
+ (ui_out::end): ... this.
+ (ui_out_field_int): Replace with ...
+ (ui_out::field_int): ... this.
+ (ui_out_field_fmt_int): Replace with ...
+ (ui_out::field_fmt_int): ... this.
+ (ui_out_field_core_addr): Replace with ...
+ (ui_out::field_core_addr): ... this.
+ (ui_out_field_stream): Replace with ...
+ (ui_out::field_stream): ... this.
+ (ui_out_field_skip): Replace with ...
+ (ui_out::field_skip): ... this.
+ (ui_out_field_string): Replace with ...
+ (ui_out::field_string): ... this.
+ (ui_out_field_fmt): Replace with ...
+ (ui_out::field_fmt): ... this.
+ (ui_out_spaces): Replace with ...
+ (ui_out::spaces): ... this.
+ (ui_out_text): Replace with ...
+ (ui_out::text): ... this.
+ (ui_out_message): Replace with ...
+ (ui_out::message): ... this.
+ (ui_out_wrap_hint): Replace with ...
+ (ui_out::wrap_hint): ... this.
+ (ui_out_flush): Replace with ...
+ (ui_out::flush): ... this.
+ (ui_out_redirect): Replace with ...
+ (ui_out::redirect): ... this.
+ (ui_out_test_flags): Replace with ...
+ (ui_out::test_flags): ... this.
+ (ui_out_is_mi_like_p): Replace with ...
+ (ui_out::is_mi_like_p): ... this.
+ (verify_field): Replace with ...
+ (ui_out::verify_field): ... this.
+ (ui_out_query_field): Replace with ...
+ (ui_out::query_table_field): ... this.
+ (ui_out_data): Remove.
+ (ui_out_new): Remove, replace with ...
+ (ui_out::ui_out): ... this constructor.
+ (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
+ do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
+ make_cleanup_ui_out_list_begin_end): Update fallouts of struct
+ ui_out -> class ui_out change.
+ * cli-out.c (cli_out_data): Remove.
+ (cli_uiout_dtor): Remove.
+ (cli_table_begin): Replace with ...
+ (cli_ui_out::do_table_begin): ... this new method.
+ (cli_table_body): Replace with ...
+ (cli_ui_out::do_table_body): ... this new method.
+ (cli_table_end): Replace with ...
+ (cli_ui_out::do_table_end): ... this new method.
+ (cli_table_header): Replace with ...
+ (cli_ui_out::do_table_header): ... this new method.
+ (cli_begin): Replace with ...
+ (cli_ui_out::do_begin): ... this new method.
+ (cli_end): Replace with ...
+ (cli_ui_out::do_end): ... this new method.
+ (cli_field_int): Replace with ...
+ (cli_ui_out::do_field_int): ... this new method.
+ (cli_field_skip): Replace with ...
+ (cli_ui_out::do_field_skip): ... this new method.
+ (cli_field_string): Replace with ...
+ (cli_ui_out::do_field_string): ... this new method.
+ (cli_field_fmt): Replace with ...
+ (cli_ui_out::do_field_fmt): ... this new method.
+ (cli_spaces): Replace with ...
+ (cli_ui_out::do_spaces): ... this new method.
+ (cli_text): Replace with ...
+ (cli_ui_out::do_text): ... this new method.
+ (cli_message): Replace with ...
+ (cli_ui_out::do_message): ... this new method.
+ (cli_wrap_hint): Replace with ...
+ (cli_ui_out::do_wrap_hint): ... this new method.
+ (cli_flush): Replace with ...
+ (cli_ui_out::do_flush): ... this new method.
+ (cli_redirect): Replace with ...
+ (cli_ui_out::do_redirect): ... this new method.
+ (out_field_fmt): Replace with ...
+ (cli_ui_out::out_field_fmt): ... this new method.
+ (field_separator): Replace with ...
+ (cli_ui_out::field_separator): ... this new method.
+ (cli_out_set_stream): Replace with ...
+ (cli_ui_out::set_stream): ... this new method.
+ (cli_ui_out_impl): Remove.
+ (cli_out_data_ctor): Remove.
+ (cli_ui_out_impl::cli_ui_out_impl): New constructor.
+ (cli_ui_out_impl::~cli_ui_out_impl): New destructor.
+ (cli_out_new): Change return type to cli_ui_out *, instantiate a
+ cli_ui_out.
+ * cli-out.h (cli_ui_out_data): Remove, replace with class
+ cli_ui_out.
+ (class cli_ui_out): New class.
+ (cli_ui_out_impl): Remove.
+ (cli_out_data_ctor): Remove.
+ (cli_out_new): Change return type to cli_ui_out*.
+ (cli_out_set_stream): Remove.
+ * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
+ to cli_ui_out*.
+ (cli_interpreter_resume): Adapt.
+ (cli_interpreter_exec): Adapt.
+ * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
+ (mi_ui_out_impl): Remove.
+ (mi_table_begin): Replace with ...
+ (mi_ui_out::do_table_begin): ... this.
+ (mi_table_body): Replace with ...
+ (mi_ui_out::do_table_body): ... this.
+ (mi_table_end): Replace with ...
+ (mi_ui_out::do_table_end): ... this.
+ (mi_table_header): Replace with ...
+ (mi_ui_out::do_table_header): ... this.
+ (mi_begin): Replace with ...
+ (mi_ui_out::do_begin): ... this.
+ (mi_end): Replace with ...
+ (mi_ui_out::do_end): ... this.
+ (mi_field_int): Replace with ...
+ (mi_ui_out::do_field_int): ... this.
+ (mi_field_skip): Replace with ...
+ (mi_ui_out::do_field_skip): ... this.
+ (mi_field_string): Replace with ...
+ (mi_ui_out::do_field_string): ... this.
+ (mi_field_fmt): Replace with ...
+ (mi_ui_out::do_field_fmt): ... this.
+ (mi_spaces): Replace with ...
+ (mi_ui_out::do_spaces): ... this.
+ (mi_text): Replace with ...
+ (mi_ui_out::do_text): ... this.
+ (mi_message): Replace with ...
+ (mi_ui_out::do_message): ... this.
+ (mi_wrap_hint): Replace with ...
+ (mi_ui_out::do_wrap_hint): ... this.
+ (mi_flush): Replace with ...
+ (mi_ui_out::do_flush): ... this.
+ (mi_redirect): Replace with ...
+ (mi_ui_out::do_redirect):
+ (field_separator): Replace with ...
+ (mi_ui_out::field_separator):
+ (mi_open): Replace with ...
+ (mi_ui_out::open): ... this.
+ (mi_close): Replace with ...
+ (mi_ui_out::close): ... this.
+ (mi_out_rewind): Replace with ...
+ (mi_ui_out::rewind): ... this.
+ (mi_out_put): Replace with ...
+ (mi_ui_out::put): ... this.
+ (mi_version): Replace with ...
+ (mi_ui_out::version): ... this.
+ (mi_out_data_ctor): Replace with ...
+ (mi_ui_out::mi_ui_out): ... this.
+ (mi_out_data_dtor): Replace with ...
+ (mi_ui_out::~mi_ui_out): ... this.
+ (mi_out_new): Change return type to mi_ui_out*, instantiate
+ an mi_ui_out object.
+ (as_mi_ui_out): New function.
+ (mi_version): Update fallouts of struct ui_out to class ui_out
+ transition.
+ (mi_out_put): Likewise.
+ (mi_out_rewind): Likewise.
+ * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
+ * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
+ Remove.
+ (tui_field_int): Replace with ...
+ (tui_ui_out::do_field_int): ... this.
+ (tui_field_string): Replace with ...
+ (tui_ui_out::do_field_string): ... this.
+ (tui_field_fmt): Replace with ...
+ (tui_ui_out::do_field_fmt): ... this.
+ (tui_text): Replace with ...
+ (tui_ui_out::do_text): ... this.
+ (tui_out_new): Change return type to tui_ui_out*, instantiate
+ tui_ui_out object.
+ (tui_ui_out::tui_ui_out): New.
+ * tui/tui-out.h: New file.
+ * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
+ * tui/tui-io.c: Include tui/tui-out.h.
+ (tui_old_uiout): Change type to cli_ui_out*.
+ (tui_setup_io): Use dynamic_cast.
+ * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
+ * tui/tui-interp.c (tui_resume): Adapt.
+ * ada-lang.c (print_it_exception): Update fallouts of struct
+ ui_out to class ui_out transition.
+ (print_one_exception): Likewise.
+ (print_mention_exception): Likewise.
+ * ada-tasks.c (print_ada_task_info): Likewise.
+ (info_task): Likewise.
+ (task_command): Likewise.
+ * auto-load.c (print_script): Likewise.
+ (auto_load_info_scripts): Likewise.
+ (info_auto_load_cmd): Likewise.
+ * break-catch-sig.c (signal_catchpoint_print_one): Likewise.
+ * break-catch-syscall.c (print_it_catch_syscall): Likewise.
+ (print_one_catch_syscall): Likewise.
+ * break-catch-throw.c (print_it_exception_catchpoint): Likewise.
+ (print_one_exception_catchpoint): Likewise.
+ (print_one_detail_exception_catchpoint): Likewise.
+ (print_mention_exception_catchpoint): Likewise.
+ * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
+ (print_solib_event): Likewise.
+ (watchpoint_check): Likewise.
+ (wrap_indent_at_field): Likewise.
+ (print_breakpoint_location): Likewise.
+ (output_thread_groups): Likewise.
+ (print_one_breakpoint_location): Likewise.
+ (breakpoint_1): Likewise.
+ (default_collect_info): Likewise.
+ (watchpoints_info): Likewise.
+ (print_it_catch_fork): Likewise.
+ (print_one_catch_fork): Likewise.
+ (print_it_catch_vfork): Likewise.
+ (print_one_catch_vfork): Likewise.
+ (print_it_catch_solib): Likewise.
+ (print_one_catch_solib): Likewise.
+ (print_it_catch_exec): Likewise.
+ (print_one_catch_exec): Likewise.
+ (mention): Likewise.
+ (print_it_ranged_breakpoint): Likewise.
+ (print_one_ranged_breakpoint): Likewise.
+ (print_one_detail_ranged_breakpoint): Likewise.
+ (print_mention_ranged_breakpoint): Likewise.
+ (print_it_watchpoint): Likewise.
+ (print_mention_watchpoint): Likewise.
+ (print_it_masked_watchpoint): Likewise.
+ (print_one_detail_masked_watchpoint): Likewise.
+ (print_mention_masked_watchpoint): Likewise.
+ (bkpt_print_it): Likewise.
+ (tracepoint_print_one_detail): Likewise.
+ (tracepoint_print_mention): Likewise.
+ (update_static_tracepoint): Likewise.
+ (tracepoints_info): Likewise.
+ (save_breakpoints): Likewise.
+ * cli/cli-cmds.c (complete_command): Likewise.
+ * cli/cli-logging.c (set_logging_redirect): Likewise.
+ (pop_output_files): Likewise.
+ (handle_redirections): Likewise.
+ * cli/cli-script.c (print_command_lines): Likewise.
+ * cli/cli-setshow.c (do_show_command): Likewise.
+ (cmd_show_list): Likewise.
+ * cp-abi.c (list_cp_abis): Likewise.
+ (show_cp_abi_cmd): Likewise.
+ * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
+ * disasm.c (gdb_pretty_print_insn): Likewise.
+ (do_mixed_source_and_assembly_deprecated): Likewise.
+ (do_mixed_source_and_assembly): Likewise.
+ * gdb_bfd.c (print_one_bfd): Likewise.
+ (maintenance_info_bfds): Likewise.
+ * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
+ * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
+ * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
+ * i386-tdep.c (i386_mpx_print_bounds): Likewise.
+ * infcmd.c (run_command_1): Likewise.
+ (print_return_value_1): Likewise.
+ * inferior.c (print_selected_inferior): Likewise.
+ (print_inferior): Likewise.
+ * infrun.c (print_end_stepping_range_reason): Likewise.
+ (print_signal_exited_reason): Likewise.
+ (print_exited_reason): Likewise.
+ (print_signal_received_reason): Likewise.
+ (print_no_history_reason): Likewise.
+ * interps.c (interp_set): Likewise.
+ * linespec.c (decode_line_full): Likewise.
+ * linux-thread-db.c (info_auto_load_libthread_db): Likewise.
+ * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
+ (mi_cmd_env_path): Likewise.
+ (mi_cmd_env_dir): Likewise.
+ (mi_cmd_inferior_tty_show): Likewise.
+ * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
+ (print_partial_file_name): Likewise.
+ (mi_cmd_file_list_exec_source_files): Likewise.
+ * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
+ (mi_cmd_info_gdb_mi_command): Likewise.
+ * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
+ (mi_cmd_stack_list_args): Likewise.
+ (list_arg_or_local): Likewise.
+ * mi/mi-cmd-var.c (print_varobj): Likewise.
+ (mi_cmd_var_create): Likewise.
+ (mi_cmd_var_delete): Likewise.
+ (mi_cmd_var_set_format): Likewise.
+ (mi_cmd_var_show_format): Likewise.
+ (mi_cmd_var_info_num_children): Likewise.
+ (mi_cmd_var_list_children): Likewise.
+ (mi_cmd_var_info_type): Likewise.
+ (mi_cmd_var_info_path_expression): Likewise.
+ (mi_cmd_var_info_expression): Likewise.
+ (mi_cmd_var_show_attributes): Likewise.
+ (mi_cmd_var_evaluate_expression): Likewise.
+ (mi_cmd_var_assign): Likewise.
+ (varobj_update_one): Likewise.
+ * mi/mi-interp.c (as_mi_interp): Likewise.
+ (mi_on_normal_stop_1): Likewise.
+ (mi_tsv_modified): Likewise.
+ (mi_breakpoint_created): Likewise.
+ (mi_breakpoint_modified): Likewise.
+ (mi_solib_loaded): Likewise.
+ (mi_solib_unloaded): Likewise.
+ (mi_command_param_changed): Likewise.
+ (mi_memory_changed): Likewise.
+ (mi_user_selected_context_changed): Likewise.
+ * mi/mi-main.c (print_one_inferior): Likewise.
+ (output_cores): Likewise.
+ (list_available_thread_groups): Likewise.
+ (mi_cmd_data_list_register_names): Likewise.
+ (mi_cmd_data_list_changed_registers): Likewise.
+ (output_register): Likewise.
+ (mi_cmd_data_evaluate_expression): Likewise.
+ (mi_cmd_data_read_memory): Likewise.
+ (mi_cmd_data_read_memory_bytes): Likewise.
+ (mi_cmd_list_features): Likewise.
+ (mi_cmd_list_target_features): Likewise.
+ (mi_cmd_add_inferior): Likewise.
+ (mi_execute_command): Likewise.
+ (mi_load_progress): Likewise.
+ (print_variable_or_computed): Likewise.
+ (mi_cmd_trace_frame_collected): Likewise.
+ * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
+ * osdata.c (info_osdata_command): Likewise.
+ * probe.c (gen_ui_out_table_header_info): Likewise.
+ (print_ui_out_not_applicables): Likewise.
+ (print_ui_out_info): Likewise.
+ (info_probes_for_ops): Likewise.
+ (enable_probes_command): Likewise.
+ (disable_probes_command): Likewise.
+ * progspace.c (print_program_space): Likewise.
+ * python/py-breakpoint.c (bppy_get_commands): Likewise.
+ * python/py-framefilter.c (py_print_type): Likewise.
+ (py_print_value): Likewise.
+ (py_print_single_arg): Likewise.
+ (enumerate_args): Likewise.
+ (enumerate_locals): Likewise.
+ (py_print_args): Likewise.
+ (py_print_frame): Likewise.
+ * record-btrace.c (btrace_ui_out_decode_error): Likewise.
+ (btrace_call_history_insn_range): Likewise.
+ (btrace_call_history_src_line): Likewise.
+ (btrace_call_history): Likewise.
+ * remote.c (show_remote_cmd): Likewise.
+ * skip.c (skip_info): Likewise.
+ * solib.c (info_sharedlibrary_command): Likewise.
+ * source.c (print_source_lines_base): Likewise.
+ * spu-tdep.c (info_spu_event_command): Likewise.
+ (info_spu_signal_command): Likewise.
+ (info_spu_mailbox_list): Likewise.
+ (info_spu_dma_cmdlist): Likewise.
+ (info_spu_dma_command): Likewise.
+ (info_spu_proxydma_command): Likewise.
+ * stack.c (print_stack_frame): Likewise.
+ (print_frame_arg): Likewise.
+ (read_frame_arg): Likewise.
+ (print_frame_args): Likewise.
+ (print_frame_info): Likewise.
+ (print_frame): Likewise.
+ * symfile.c (load_progress): Likewise.
+ (generic_load): Likewise.
+ (print_transfer_performance): Likewise.
+ * thread.c (do_captured_list_thread_ids): Likewise.
+ (print_thread_info_1): Likewise.
+ (restore_selected_frame): Likewise.
+ (do_captured_thread_select): Likewise.
+ (print_selected_thread_frame): Likewise.
+ * top.c (execute_command_to_string): Likewise.
+ * tracepoint.c (tvariables_info_1): Likewise.
+ (trace_status_mi): Likewise.
+ (tfind_1): Likewise.
+ (print_one_static_tracepoint_marker): Likewise.
+ (info_static_tracepoint_markers_command): Likewise.
+ * utils.c (do_ui_out_redirect_pop): Likewise.
+ (fputs_maybe_filtered): Likewise.
+
2016-12-20 Pedro Alves <palves@redhat.com>
* nto-tdep.c (nto_find_and_open_solib): Constify 'solib'
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index d2d0340..a79ec2b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12469,18 +12469,17 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
annotate_catchpoint (b->number);
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
+ uiout->field_string ("reason",
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_text (uiout,
- b->disposition == disp_del ? "\nTemporary catchpoint "
- : "\nCatchpoint ");
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, ", ");
+ uiout->text (b->disposition == disp_del
+ ? "\nTemporary catchpoint " : "\nCatchpoint ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (", ");
/* ada_exception_name_addr relies on the selected frame being the
current frame. Need to do this here because this function may be
@@ -12519,8 +12518,8 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
hit. We used ui_out_text to make sure that this extra
info does not pollute the exception name in the MI case. */
if (ex == ada_catch_exception_unhandled)
- ui_out_text (uiout, "unhandled ");
- ui_out_field_string (uiout, "exception-name", exception_name);
+ uiout->text ("unhandled ");
+ uiout->field_string ("exception-name", exception_name);
}
break;
case ada_catch_assert:
@@ -12529,10 +12528,10 @@ print_it_exception (enum ada_exception_catchpoint_kind ex, bpstat bs)
that his program just hit an assertion-failure catchpoint.
We used ui_out_text because this info does not belong in
the MI output. */
- ui_out_text (uiout, "failed assertion");
+ uiout->text ("failed assertion");
break;
}
- ui_out_text (uiout, " at ");
+ uiout->text (" at ");
ada_find_printable_frame (get_current_frame ());
return PRINT_SRC_AND_LOC;
@@ -12553,7 +12552,7 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
if (opts.addressprint)
{
annotate_field (4);
- ui_out_field_core_addr (uiout, "addr", b->loc->gdbarch, b->loc->address);
+ uiout->field_core_addr ("addr", b->loc->gdbarch, b->loc->address);
}
annotate_field (5);
@@ -12565,20 +12564,20 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
{
char *msg = xstrprintf (_("`%s' Ada exception"), c->excep_string);
- ui_out_field_string (uiout, "what", msg);
+ uiout->field_string ("what", msg);
xfree (msg);
}
else
- ui_out_field_string (uiout, "what", "all Ada exceptions");
+ uiout->field_string ("what", "all Ada exceptions");
break;
case ada_catch_exception_unhandled:
- ui_out_field_string (uiout, "what", "unhandled Ada exceptions");
+ uiout->field_string ("what", "unhandled Ada exceptions");
break;
case ada_catch_assert:
- ui_out_field_string (uiout, "what", "failed Ada assertions");
+ uiout->field_string ("what", "failed Ada assertions");
break;
default:
@@ -12597,10 +12596,10 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
struct ada_catchpoint *c = (struct ada_catchpoint *) b;
struct ui_out *uiout = current_uiout;
- ui_out_text (uiout, b->disposition == disp_del ? _("Temporary catchpoint ")
+ uiout->text (b->disposition == disp_del ? _("Temporary catchpoint ")
: _("Catchpoint "));
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, ": ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (": ");
switch (ex)
{
@@ -12610,19 +12609,19 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
char *info = xstrprintf (_("`%s' Ada exception"), c->excep_string);
struct cleanup *old_chain = make_cleanup (xfree, info);
- ui_out_text (uiout, info);
+ uiout->text (info);
do_cleanups (old_chain);
}
else
- ui_out_text (uiout, _("all Ada exceptions"));
+ uiout->text (_("all Ada exceptions"));
break;
case ada_catch_exception_unhandled:
- ui_out_text (uiout, _("unhandled Ada exceptions"));
+ uiout->text (_("unhandled Ada exceptions"));
break;
case ada_catch_assert:
- ui_out_text (uiout, _("failed Ada assertions"));
+ uiout->text (_("failed Ada assertions"));
break;
default:
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 31092fd..be8d44b 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1013,15 +1013,14 @@ print_ada_task_info (struct ui_out *uiout,
if (ada_build_task_list () == 0)
{
- ui_out_message (uiout,
- _("Your application does not use any Ada tasks.\n"));
+ uiout->message (_("Your application does not use any Ada tasks.\n"));
return;
}
if (arg_str != NULL && arg_str[0] != '\0')
taskno_arg = value_as_long (parse_and_eval (arg_str));
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
/* In GDB/MI mode, we want to provide the thread ID corresponding
to each task. This allows clients to quickly find the thread
associated to any task, which is helpful for commands that
@@ -1047,25 +1046,25 @@ print_ada_task_info (struct ui_out *uiout,
else
nb_tasks = VEC_length (ada_task_info_s, data->task_list);
- nb_columns = ui_out_is_mi_like_p (uiout) ? 8 : 7;
+ nb_columns = uiout->is_mi_like_p () ? 8 : 7;
old_chain = make_cleanup_ui_out_table_begin_end (uiout, nb_columns,
nb_tasks, "tasks");
- ui_out_table_header (uiout, 1, ui_left, "current", "");
- ui_out_table_header (uiout, 3, ui_right, "id", "ID");
- ui_out_table_header (uiout, 9, ui_right, "task-id", "TID");
+ uiout->table_header (1, ui_left, "current", "");
+ uiout->table_header (3, ui_right, "id", "ID");
+ uiout->table_header (9, ui_right, "task-id", "TID");
/* The following column is provided in GDB/MI mode only because
it is only really useful in that mode, and also because it
allows us to keep the CLI output shorter and more compact. */
- if (ui_out_is_mi_like_p (uiout))
- ui_out_table_header (uiout, 4, ui_right, "thread-id", "");
- ui_out_table_header (uiout, 4, ui_right, "parent-id", "P-ID");
- ui_out_table_header (uiout, 3, ui_right, "priority", "Pri");
- ui_out_table_header (uiout, 22, ui_left, "state", "State");
+ if (uiout->is_mi_like_p ())
+ uiout->table_header (4, ui_right, "thread-id", "");
+ uiout->table_header (4, ui_right, "parent-id", "P-ID");
+ uiout->table_header (3, ui_right, "priority", "Pri");
+ uiout->table_header (22, ui_left, "state", "State");
/* Use ui_noalign for the last column, to prevent the CLI uiout
from printing an extra space at the end of each row. This
is a bit of a hack, but does get the job done. */
- ui_out_table_header (uiout, 1, ui_noalign, "name", "Name");
- ui_out_table_body (uiout);
+ uiout->table_header (1, ui_noalign, "name", "Name");
+ uiout->table_body ();
for (taskno = 1;
taskno <= VEC_length (ada_task_info_s, data->task_list);
@@ -1089,61 +1088,61 @@ print_ada_task_info (struct ui_out *uiout,
/* Print a star if this task is the current task (or the task
currently selected). */
if (ptid_equal (task_info->ptid, inferior_ptid))
- ui_out_field_string (uiout, "current", "*");
+ uiout->field_string ("current", "*");
else
- ui_out_field_skip (uiout, "current");
+ uiout->field_skip ("current");
/* Print the task number. */
- ui_out_field_int (uiout, "id", taskno);
+ uiout->field_int ("id", taskno);
/* Print the Task ID. */
- ui_out_field_fmt (uiout, "task-id", "%9lx", (long) task_info->task_id);
+ uiout->field_fmt ("task-id", "%9lx", (long) task_info->task_id);
/* Print the associated Thread ID. */
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
{
const int thread_id = ptid_to_global_thread_id (task_info->ptid);
if (thread_id != 0)
- ui_out_field_int (uiout, "thread-id", thread_id);
+ uiout->field_int ("thread-id", thread_id);
else
/* This should never happen unless there is a bug somewhere,
but be resilient when that happens. */
- ui_out_field_skip (uiout, "thread-id");
+ uiout->field_skip ("thread-id");
}
/* Print the ID of the parent task. */
parent_id = get_task_number_from_id (task_info->parent, inf);
if (parent_id)
- ui_out_field_int (uiout, "parent-id", parent_id);
+ uiout->field_int ("parent-id", parent_id);
else
- ui_out_field_skip (uiout, "parent-id");
+ uiout->field_skip ("parent-id");
/* Print the base priority of the task. */
- ui_out_field_int (uiout, "priority", task_info->priority);
+ uiout->field_int ("priority", task_info->priority);
/* Print the task current state. */
if (task_info->caller_task)
- ui_out_field_fmt (uiout, "state",
+ uiout->field_fmt ("state",
_("Accepting RV with %-4d"),
get_task_number_from_id (task_info->caller_task,
inf));
else if (task_info->state == Entry_Caller_Sleep
&& task_info->called_task)
- ui_out_field_fmt (uiout, "state",
+ uiout->field_fmt ("state",
_("Waiting on RV with %-3d"),
get_task_number_from_id (task_info->called_task,
inf));
else
- ui_out_field_string (uiout, "state", task_states[task_info->state]);
+ uiout->field_string ("state", task_states[task_info->state]);
/* Finally, print the task name. */
- ui_out_field_fmt (uiout, "name",
+ uiout->field_fmt ("name",
"%s",
task_info->name[0] != '\0' ? task_info->name
: _("<no name>"));
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
do_cleanups (chain2);
}
@@ -1163,8 +1162,7 @@ info_task (struct ui_out *uiout, char *taskno_str, struct inferior *inf)
if (ada_build_task_list () == 0)
{
- ui_out_message (uiout,
- _("Your application does not use any Ada tasks.\n"));
+ uiout->message (_("Your application does not use any Ada tasks.\n"));
return;
}
@@ -1328,8 +1326,7 @@ task_command (char *taskno_str, int from_tty)
if (ada_build_task_list () == 0)
{
- ui_out_message (uiout,
- _("Your application does not use any Ada tasks.\n"));
+ uiout->message (_("Your application does not use any Ada tasks.\n"));
return;
}
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 958c24e..52cebf1 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1271,17 +1271,17 @@ print_script (struct loaded_script *script)
chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
- ui_out_field_string (uiout, "loaded", script->loaded ? "Yes" : "No");
- ui_out_field_string (uiout, "script", script->name);
- ui_out_text (uiout, "\n");
+ uiout->field_string ("loaded", script->loaded ? "Yes" : "No");
+ uiout->field_string ("script", script->name);
+ uiout->text ("\n");
/* If the name isn't the full path, print it too. */
if (script->full_path != NULL
&& strcmp (script->name, script->full_path) != 0)
{
- ui_out_text (uiout, "\tfull name: ");
- ui_out_field_string (uiout, "full_path", script->full_path);
- ui_out_text (uiout, "\n");
+ uiout->text ("\tfull name: ");
+ uiout->field_string ("full_path", script->full_path);
+ uiout->text ("\n");
}
do_cleanups (chain);
@@ -1382,15 +1382,15 @@ auto_load_info_scripts (char *pattern, int from_tty,
/* Table header shifted right by preceding "gdb-scripts: " would not match
its columns. */
if (nr_scripts > 0 && pattern == auto_load_info_scripts_pattern_nl)
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
/* Note: This creates a cleanup to output the table end marker. */
make_cleanup_ui_out_table_begin_end (uiout, 2, nr_scripts,
"AutoLoadedScriptsTable");
- ui_out_table_header (uiout, 7, ui_left, "loaded", "Loaded");
- ui_out_table_header (uiout, 70, ui_left, "script", "Script");
- ui_out_table_body (uiout);
+ uiout->table_header (7, ui_left, "loaded", "Loaded");
+ uiout->table_header (70, ui_left, "script", "Script");
+ uiout->table_body ();
print_scripts (script_files);
print_scripts (script_texts);
@@ -1401,10 +1401,9 @@ auto_load_info_scripts (char *pattern, int from_tty,
if (nr_scripts == 0)
{
if (pattern && *pattern)
- ui_out_message (uiout, "No auto-load scripts matching %s.\n",
- pattern);
+ uiout->message ("No auto-load scripts matching %s.\n", pattern);
else
- ui_out_message (uiout, "No auto-load scripts.\n");
+ uiout->message ("No auto-load scripts.\n");
}
}
@@ -1571,8 +1570,8 @@ info_auto_load_cmd (char *args, int from_tty)
gdb_assert (!list->prefixlist);
gdb_assert (list->type == not_set_cmd);
- ui_out_field_string (uiout, "name", list->name);
- ui_out_text (uiout, ": ");
+ uiout->field_string ("name", list->name);
+ uiout->text (": ");
cmd_func (list, auto_load_info_scripts_pattern_nl, from_tty);
/* Close the tuple. */
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index e869a83..97d14b6 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -253,14 +253,14 @@ signal_catchpoint_print_one (struct breakpoint *b,
not line up too nicely with the headers, but the effect
is relatively readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
if (c->signals_to_be_caught
&& VEC_length (gdb_signal_type, c->signals_to_be_caught) > 1)
- ui_out_text (uiout, "signals \"");
+ uiout->text ("signals \"");
else
- ui_out_text (uiout, "signal \"");
+ uiout->text ("signal \"");
if (c->signals_to_be_caught)
{
@@ -278,15 +278,15 @@ signal_catchpoint_print_one (struct breakpoint *b,
text += " ";
text += name;
}
- ui_out_field_string (uiout, "what", text.c_str ());
+ uiout->field_string ("what", text.c_str ());
}
else
- ui_out_field_string (uiout, "what",
+ uiout->field_string ("what",
c->catch_all ? "<any signal>" : "<standard signals>");
- ui_out_text (uiout, "\" ");
+ uiout->text ("\" ");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "signal");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "signal");
}
/* Implement the "print_mention" breakpoint_ops method for signal
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index a4df2ce..8d34173 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -257,30 +257,30 @@ print_it_catch_syscall (bpstat bs)
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary catchpoint ");
+ uiout->text ("Temporary catchpoint ");
else
- ui_out_text (uiout, "Catchpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Catchpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
+ uiout->field_string ("reason",
async_reason_lookup (last.kind == TARGET_WAITKIND_SYSCALL_ENTRY
? EXEC_ASYNC_SYSCALL_ENTRY
: EXEC_ASYNC_SYSCALL_RETURN));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
+ uiout->field_int ("bkptno", b->number);
if (last.kind == TARGET_WAITKIND_SYSCALL_ENTRY)
- ui_out_text (uiout, " (call to syscall ");
+ uiout->text (" (call to syscall ");
else
- ui_out_text (uiout, " (returned from syscall ");
+ uiout->text (" (returned from syscall ");
- if (s.name == NULL || ui_out_is_mi_like_p (uiout))
- ui_out_field_int (uiout, "syscall-number", last.value.syscall_number);
+ if (s.name == NULL || uiout->is_mi_like_p ())
+ uiout->field_int ("syscall-number", last.value.syscall_number);
if (s.name != NULL)
- ui_out_field_string (uiout, "syscall-name", s.name);
+ uiout->field_string ("syscall-name", s.name);
- ui_out_text (uiout, "), ");
+ uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -302,14 +302,14 @@ print_one_catch_syscall (struct breakpoint *b,
line up too nicely with the headers, but the effect is relatively
readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
if (c->syscalls_to_be_caught
&& VEC_length (int, c->syscalls_to_be_caught) > 1)
- ui_out_text (uiout, "syscalls \"");
+ uiout->text ("syscalls \"");
else
- ui_out_text (uiout, "syscall \"");
+ uiout->text ("syscall \"");
if (c->syscalls_to_be_caught)
{
@@ -336,14 +336,14 @@ print_one_catch_syscall (struct breakpoint *b,
}
/* Remove the last comma. */
text[strlen (text) - 2] = '\0';
- ui_out_field_string (uiout, "what", text);
+ uiout->field_string ("what", text);
}
else
- ui_out_field_string (uiout, "what", "<any syscall>");
- ui_out_text (uiout, "\" ");
+ uiout->field_string ("what", "<any syscall>");
+ uiout->text ("\" ");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "syscall");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "syscall");
}
/* Implement the "print_mention" breakpoint_ops method for syscall
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 955b2ff..051e479 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -261,21 +261,19 @@ print_it_exception_catchpoint (bpstat bs)
maybe_print_thread_hit_breakpoint (uiout);
bp_temp = b->disposition == disp_del;
- ui_out_text (uiout,
- bp_temp ? "Temporary catchpoint "
+ uiout->text (bp_temp ? "Temporary catchpoint "
: "Catchpoint ");
- if (!ui_out_is_mi_like_p (uiout))
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout,
- (kind == EX_EVENT_THROW ? " (exception thrown), "
+ if (!uiout->is_mi_like_p ())
+ uiout->field_int ("bkptno", b->number);
+ uiout->text ((kind == EX_EVENT_THROW ? " (exception thrown), "
: (kind == EX_EVENT_CATCH ? " (exception caught), "
: " (exception rethrown), ")));
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
+ uiout->field_string ("reason",
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
- ui_out_field_int (uiout, "bkptno", b->number);
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
+ uiout->field_int ("bkptno", b->number);
}
return PRINT_SRC_AND_LOC;
}
@@ -293,9 +291,9 @@ print_one_exception_catchpoint (struct breakpoint *b,
{
annotate_field (4);
if (b->loc == NULL || b->loc->shlib_disabled)
- ui_out_field_string (uiout, "addr", "<PENDING>");
+ uiout->field_string ("addr", "<PENDING>");
else
- ui_out_field_core_addr (uiout, "addr",
+ uiout->field_core_addr ("addr",
b->loc->gdbarch, b->loc->address);
}
annotate_field (5);
@@ -305,21 +303,21 @@ print_one_exception_catchpoint (struct breakpoint *b,
switch (kind)
{
case EX_EVENT_THROW:
- ui_out_field_string (uiout, "what", "exception throw");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "throw");
+ uiout->field_string ("what", "exception throw");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "throw");
break;
case EX_EVENT_RETHROW:
- ui_out_field_string (uiout, "what", "exception rethrow");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "rethrow");
+ uiout->field_string ("what", "exception rethrow");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "rethrow");
break;
case EX_EVENT_CATCH:
- ui_out_field_string (uiout, "what", "exception catch");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "catch");
+ uiout->field_string ("what", "exception catch");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "catch");
break;
}
}
@@ -335,9 +333,9 @@ print_one_detail_exception_catchpoint (const struct breakpoint *b,
if (cp->exception_rx != NULL)
{
- ui_out_text (uiout, _("\tmatching: "));
- ui_out_field_string (uiout, "regexp", cp->exception_rx);
- ui_out_text (uiout, "\n");
+ uiout->text (_("\tmatching: "));
+ uiout->field_string ("regexp", cp->exception_rx);
+ uiout->text ("\n");
}
}
@@ -349,10 +347,10 @@ print_mention_exception_catchpoint (struct breakpoint *b)
enum exception_event_kind kind = classify_exception_breakpoint (b);
bp_temp = b->disposition == disp_del;
- ui_out_text (uiout, bp_temp ? _("Temporary catchpoint ")
+ uiout->text (bp_temp ? _("Temporary catchpoint ")
: _("Catchpoint "));
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, (kind == EX_EVENT_THROW ? _(" (throw)")
+ uiout->field_int ("bkptno", b->number);
+ uiout->text ((kind == EX_EVENT_THROW ? _(" (throw)")
: (kind == EX_EVENT_CATCH ? _(" (catch)")
: _(" (rethrow)"))));
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 92aac3a..6fd18fd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4800,28 +4800,28 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
void
maybe_print_thread_hit_breakpoint (struct ui_out *uiout)
{
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
return;
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
if (show_thread_that_caused_stop ())
{
const char *name;
struct thread_info *thr = inferior_thread ();
- ui_out_text (uiout, "Thread ");
- ui_out_field_fmt (uiout, "thread-id", "%s", print_thread_id (thr));
+ uiout->text ("Thread ");
+ uiout->field_fmt ("thread-id", "%s", print_thread_id (thr));
name = thr->name != NULL ? thr->name : target_thread_name (thr);
if (name != NULL)
{
- ui_out_text (uiout, " \"");
- ui_out_field_fmt (uiout, "name", "%s", name);
- ui_out_text (uiout, "\"");
+ uiout->text (" \"");
+ uiout->field_fmt ("name", "%s", name);
+ uiout->text ("\"");
}
- ui_out_text (uiout, " hit ");
+ uiout->text (" hit ");
}
}
@@ -4881,17 +4881,15 @@ print_solib_event (int is_catchpoint)
if (!is_catchpoint)
{
if (any_added || any_deleted)
- ui_out_text (current_uiout,
- _("Stopped due to shared library event:\n"));
+ current_uiout->text (_("Stopped due to shared library event:\n"));
else
- ui_out_text (current_uiout,
- _("Stopped due to shared library event (no "
- "libraries added or removed)\n"));
+ current_uiout->text (_("Stopped due to shared library event (no "
+ "libraries added or removed)\n"));
}
- if (ui_out_is_mi_like_p (current_uiout))
- ui_out_field_string (current_uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_SOLIB_EVENT));
+ if (current_uiout->is_mi_like_p ())
+ current_uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_SOLIB_EVENT));
if (any_deleted)
{
@@ -4899,7 +4897,7 @@ print_solib_event (int is_catchpoint)
char *name;
int ix;
- ui_out_text (current_uiout, _(" Inferior unloaded "));
+ current_uiout->text (_(" Inferior unloaded "));
cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
"removed");
for (ix = 0;
@@ -4908,9 +4906,9 @@ print_solib_event (int is_catchpoint)
++ix)
{
if (ix > 0)
- ui_out_text (current_uiout, " ");
- ui_out_field_string (current_uiout, "library", name);
- ui_out_text (current_uiout, "\n");
+ current_uiout->text (" ");
+ current_uiout->field_string ("library", name);
+ current_uiout->text ("\n");
}
do_cleanups (cleanup);
@@ -4922,7 +4920,7 @@ print_solib_event (int is_catchpoint)
int ix;
struct cleanup *cleanup;
- ui_out_text (current_uiout, _(" Inferior loaded "));
+ current_uiout->text (_(" Inferior loaded "));
cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
"added");
for (ix = 0;
@@ -4931,9 +4929,9 @@ print_solib_event (int is_catchpoint)
++ix)
{
if (ix > 0)
- ui_out_text (current_uiout, " ");
- ui_out_field_string (current_uiout, "library", iter->so_name);
- ui_out_text (current_uiout, "\n");
+ current_uiout->text (" ");
+ current_uiout->field_string ("library", iter->so_name);
+ current_uiout->text ("\n");
}
do_cleanups (cleanup);
@@ -5257,13 +5255,12 @@ watchpoint_check (void *p)
{
struct ui_out *uiout = current_uiout;
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
- ui_out_text (uiout, "\nWatchpoint ");
- ui_out_field_int (uiout, "wpnum", b->base.number);
- ui_out_text (uiout,
- " deleted because the program has left the block in\n"
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
+ uiout->text ("\nWatchpoint ");
+ uiout->field_int ("wpnum", b->base.number);
+ uiout->text (" deleted because the program has left the block in\n"
"which its expression is valid.\n");
}
@@ -6065,7 +6062,7 @@ wrap_indent_at_field (struct ui_out *uiout, const char *col_name)
const char *text;
total_width = 0;
- for (i = 1; ui_out_query_field (uiout, i, &width, &align, &text); i++)
+ for (i = 1; uiout->query_table_field (i, &width, &align, &text); i++)
{
if (strcmp (text, col_name) == 0)
{
@@ -6158,30 +6155,27 @@ print_breakpoint_location (struct breakpoint *b,
set_current_program_space (loc->pspace);
if (b->display_canonical)
- ui_out_field_string (uiout, "what",
- event_location_to_string (b->location));
+ uiout->field_string ("what", event_location_to_string (b->location));
else if (loc && loc->symtab)
{
struct symbol *sym
= find_pc_sect_function (loc->address, loc->section);
if (sym)
{
- ui_out_text (uiout, "in ");
- ui_out_field_string (uiout, "func",
- SYMBOL_PRINT_NAME (sym));
- ui_out_text (uiout, " ");
- ui_out_wrap_hint (uiout, wrap_indent_at_field (uiout, "what"));
- ui_out_text (uiout, "at ");
+ uiout->text ("in ");
+ uiout->field_string ("func", SYMBOL_PRINT_NAME (sym));
+ uiout->text (" ");
+ uiout->wrap_hint (wrap_indent_at_field (uiout, "what"));
+ uiout->text ("at ");
}
- ui_out_field_string (uiout, "file",
+ uiout->field_string ("file",
symtab_to_filename_for_display (loc->symtab));
- ui_out_text (uiout, ":");
+ uiout->text (":");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "fullname",
- symtab_to_fullname (loc->symtab));
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("fullname", symtab_to_fullname (loc->symtab));
- ui_out_field_int (uiout, "line", loc->line_number);
+ uiout->field_int ("line", loc->line_number);
}
else if (loc)
{
@@ -6190,24 +6184,23 @@ print_breakpoint_location (struct breakpoint *b,
print_address_symbolic (loc->gdbarch, loc->address, stb,
demangle, "");
- ui_out_field_stream (uiout, "at", stb);
+ uiout->field_stream ("at", stb);
do_cleanups (stb_chain);
}
else
{
- ui_out_field_string (uiout, "pending",
- event_location_to_string (b->location));
+ uiout->field_string ("pending", event_location_to_string (b->location));
/* If extra_string is available, it could be holding a condition
or dprintf arguments. In either case, make sure it is printed,
too, but only for non-MI streams. */
- if (!ui_out_is_mi_like_p (uiout) && b->extra_string != NULL)
+ if (!uiout->is_mi_like_p () && b->extra_string != NULL)
{
if (b->type == bp_dprintf)
- ui_out_text (uiout, ",");
+ uiout->text (",");
else
- ui_out_text (uiout, " ");
- ui_out_text (uiout, b->extra_string);
+ uiout->text (" ");
+ uiout->text (b->extra_string);
}
}
@@ -6215,10 +6208,10 @@ print_breakpoint_location (struct breakpoint *b,
&& breakpoint_condition_evaluation_mode () == condition_evaluation_target
&& bp_condition_evaluator (b) == condition_evaluation_both)
{
- ui_out_text (uiout, " (");
- ui_out_field_string (uiout, "evaluated-by",
+ uiout->text (" (");
+ uiout->field_string ("evaluated-by",
bp_location_condition_evaluator (loc));
- ui_out_text (uiout, ")");
+ uiout->text (")");
}
do_cleanups (old_chain);
@@ -6289,7 +6282,7 @@ output_thread_groups (struct ui_out *uiout,
int mi_only)
{
struct cleanup *back_to;
- int is_mi = ui_out_is_mi_like_p (uiout);
+ int is_mi = uiout->is_mi_like_p ();
int inf;
int i;
@@ -6307,16 +6300,16 @@ output_thread_groups (struct ui_out *uiout,
char mi_group[10];
xsnprintf (mi_group, sizeof (mi_group), "i%d", inf);
- ui_out_field_string (uiout, NULL, mi_group);
+ uiout->field_string (NULL, mi_group);
}
else
{
if (i == 0)
- ui_out_text (uiout, " inf ");
+ uiout->text (" inf ");
else
- ui_out_text (uiout, ", ");
+ uiout->text (", ");
- ui_out_text (uiout, plongest (inf));
+ uiout->text (plongest (inf));
}
}
@@ -6360,37 +6353,36 @@ print_one_breakpoint_location (struct breakpoint *b,
{
char *formatted;
formatted = xstrprintf ("%d.%d", b->number, loc_number);
- ui_out_field_string (uiout, "number", formatted);
+ uiout->field_string ("number", formatted);
xfree (formatted);
}
else
{
- ui_out_field_int (uiout, "number", b->number);
+ uiout->field_int ("number", b->number);
}
/* 2 */
annotate_field (1);
if (part_of_multiple)
- ui_out_field_skip (uiout, "type");
+ uiout->field_skip ("type");
else
- ui_out_field_string (uiout, "type", bptype_string (b->type));
+ uiout->field_string ("type", bptype_string (b->type));
/* 3 */
annotate_field (2);
if (part_of_multiple)
- ui_out_field_skip (uiout, "disp");
+ uiout->field_skip ("disp");
else
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
/* 4 */
annotate_field (3);
if (part_of_multiple)
- ui_out_field_string (uiout, "enabled", loc->enabled ? "y" : "n");
+ uiout->field_string ("enabled", loc->enabled ? "y" : "n");
else
- ui_out_field_fmt (uiout, "enabled", "%c",
- bpenables[(int) b->enable_state]);
- ui_out_spaces (uiout, 2);
+ uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
+ uiout->spaces (2);
/* 5 and 6 */
@@ -6421,9 +6413,9 @@ print_one_breakpoint_location (struct breakpoint *b,
not line up too nicely with the headers, but the effect
is relatively readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
- ui_out_field_string (uiout, "what", w->exp_string);
+ uiout->field_string ("what", w->exp_string);
}
break;
@@ -6459,11 +6451,11 @@ print_one_breakpoint_location (struct breakpoint *b,
{
annotate_field (4);
if (header_of_multiple)
- ui_out_field_string (uiout, "addr", "<MULTIPLE>");
+ uiout->field_string ("addr", "<MULTIPLE>");
else if (b->loc == NULL || loc->shlib_disabled)
- ui_out_field_string (uiout, "addr", "<PENDING>");
+ uiout->field_string ("addr", "<PENDING>");
else
- ui_out_field_core_addr (uiout, "addr",
+ uiout->field_core_addr ("addr",
loc->gdbarch, loc->address);
}
annotate_field (5);
@@ -6507,17 +6499,17 @@ print_one_breakpoint_location (struct breakpoint *b,
{
/* FIXME: This seems to be redundant and lost here; see the
"stop only in" line a little further down. */
- ui_out_text (uiout, " thread ");
- ui_out_field_int (uiout, "thread", b->thread);
+ uiout->text (" thread ");
+ uiout->field_int ("thread", b->thread);
}
else if (b->task != 0)
{
- ui_out_text (uiout, " task ");
- ui_out_field_int (uiout, "task", b->task);
+ uiout->text (" task ");
+ uiout->field_int ("task", b->task);
}
}
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
if (!part_of_multiple)
b->ops->print_one_detail (b, uiout);
@@ -6525,22 +6517,22 @@ print_one_breakpoint_location (struct breakpoint *b,
if (part_of_multiple && frame_id_p (b->frame_id))
{
annotate_field (6);
- ui_out_text (uiout, "\tstop only in stack frame at ");
+ uiout->text ("\tstop only in stack frame at ");
/* FIXME: cagney/2002-12-01: Shouldn't be poking around inside
the frame ID. */
- ui_out_field_core_addr (uiout, "frame",
+ uiout->field_core_addr ("frame",
b->gdbarch, b->frame_id.stack_addr);
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
}
if (!part_of_multiple && b->cond_string)
{
annotate_field (7);
if (is_tracepoint (b))
- ui_out_text (uiout, "\ttrace only if ");
+ uiout->text ("\ttrace only if ");
else
- ui_out_text (uiout, "\tstop only if ");
- ui_out_field_string (uiout, "cond", b->cond_string);
+ uiout->text ("\tstop only if ");
+ uiout->field_string ("cond", b->cond_string);
/* Print whether the target is doing the breakpoint's condition
evaluation. If GDB is doing the evaluation, don't print anything. */
@@ -6548,27 +6540,27 @@ print_one_breakpoint_location (struct breakpoint *b,
&& breakpoint_condition_evaluation_mode ()
== condition_evaluation_target)
{
- ui_out_text (uiout, " (");
- ui_out_field_string (uiout, "evaluated-by",
+ uiout->text (" (");
+ uiout->field_string ("evaluated-by",
bp_condition_evaluator (b));
- ui_out_text (uiout, " evals)");
+ uiout->text (" evals)");
}
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
}
if (!part_of_multiple && b->thread != -1)
{
/* FIXME should make an annotation for this. */
- ui_out_text (uiout, "\tstop only in thread ");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_int (uiout, "thread", b->thread);
+ uiout->text ("\tstop only in thread ");
+ if (uiout->is_mi_like_p ())
+ uiout->field_int ("thread", b->thread);
else
{
struct thread_info *thr = find_thread_global_id (b->thread);
- ui_out_field_string (uiout, "thread", print_thread_id (thr));
+ uiout->field_string ("thread", print_thread_id (thr));
}
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
}
if (!part_of_multiple)
@@ -6577,32 +6569,32 @@ print_one_breakpoint_location (struct breakpoint *b,
{
/* FIXME should make an annotation for this. */
if (is_catchpoint (b))
- ui_out_text (uiout, "\tcatchpoint");
+ uiout->text ("\tcatchpoint");
else if (is_tracepoint (b))
- ui_out_text (uiout, "\ttracepoint");
+ uiout->text ("\ttracepoint");
else
- ui_out_text (uiout, "\tbreakpoint");
- ui_out_text (uiout, " already hit ");
- ui_out_field_int (uiout, "times", b->hit_count);
+ uiout->text ("\tbreakpoint");
+ uiout->text (" already hit ");
+ uiout->field_int ("times", b->hit_count);
if (b->hit_count == 1)
- ui_out_text (uiout, " time\n");
+ uiout->text (" time\n");
else
- ui_out_text (uiout, " times\n");
+ uiout->text (" times\n");
}
else
{
/* Output the count also if it is zero, but only if this is mi. */
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_int (uiout, "times", b->hit_count);
+ if (uiout->is_mi_like_p ())
+ uiout->field_int ("times", b->hit_count);
}
}
if (!part_of_multiple && b->ignore_count)
{
annotate_field (8);
- ui_out_text (uiout, "\tignore next ");
- ui_out_field_int (uiout, "ignore", b->ignore_count);
- ui_out_text (uiout, " hits\n");
+ uiout->text ("\tignore next ");
+ uiout->field_int ("ignore", b->ignore_count);
+ uiout->text (" hits\n");
}
/* Note that an enable count of 1 corresponds to "enable once"
@@ -6611,15 +6603,15 @@ print_one_breakpoint_location (struct breakpoint *b,
if (!part_of_multiple && b->enable_count > 1)
{
annotate_field (8);
- ui_out_text (uiout, "\tdisable after ");
+ uiout->text ("\tdisable after ");
/* Tweak the wording to clarify that ignore and enable counts
are distinct, and have additive effect. */
if (b->ignore_count)
- ui_out_text (uiout, "additional ");
+ uiout->text ("additional ");
else
- ui_out_text (uiout, "next ");
- ui_out_field_int (uiout, "enable", b->enable_count);
- ui_out_text (uiout, " hits\n");
+ uiout->text ("next ");
+ uiout->field_int ("enable", b->enable_count);
+ uiout->text (" hits\n");
}
if (!part_of_multiple && is_tracepoint (b))
@@ -6628,9 +6620,9 @@ print_one_breakpoint_location (struct breakpoint *b,
if (tp->traceframe_usage)
{
- ui_out_text (uiout, "\ttrace buffer usage ");
- ui_out_field_int (uiout, "traceframe-usage", tp->traceframe_usage);
- ui_out_text (uiout, " bytes\n");
+ uiout->text ("\ttrace buffer usage ");
+ uiout->field_int ("traceframe-usage", tp->traceframe_usage);
+ uiout->text (" bytes\n");
}
}
@@ -6652,9 +6644,9 @@ print_one_breakpoint_location (struct breakpoint *b,
if (!part_of_multiple && t->pass_count)
{
annotate_field (10);
- ui_out_text (uiout, "\tpass count ");
- ui_out_field_int (uiout, "pass", t->pass_count);
- ui_out_text (uiout, " \n");
+ uiout->text ("\tpass count ");
+ uiout->field_int ("pass", t->pass_count);
+ uiout->text (" \n");
}
/* Don't display it when tracepoint or tracepoint location is
@@ -6663,31 +6655,31 @@ print_one_breakpoint_location (struct breakpoint *b,
{
annotate_field (11);
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "installed",
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("installed",
loc->inserted ? "y" : "n");
else
{
if (loc->inserted)
- ui_out_text (uiout, "\t");
+ uiout->text ("\t");
else
- ui_out_text (uiout, "\tnot ");
- ui_out_text (uiout, "installed on target\n");
+ uiout->text ("\tnot ");
+ uiout->text ("installed on target\n");
}
}
}
- if (ui_out_is_mi_like_p (uiout) && !part_of_multiple)
+ if (uiout->is_mi_like_p () && !part_of_multiple)
{
if (is_watchpoint (b))
{
struct watchpoint *w = (struct watchpoint *) b;
- ui_out_field_string (uiout, "original-location", w->exp_string);
+ uiout->field_string ("original-location", w->exp_string);
}
else if (b->location != NULL
&& event_location_to_string (b->location) != NULL)
- ui_out_field_string (uiout, "original-location",
+ uiout->field_string ("original-location",
event_location_to_string (b->location));
}
}
@@ -6887,32 +6879,29 @@ breakpoint_1 (char *args, int allflag,
annotate_breakpoints_headers ();
if (nr_printable_breakpoints > 0)
annotate_field (0);
- ui_out_table_header (uiout, 7, ui_left, "number", "Num"); /* 1 */
+ uiout->table_header (7, ui_left, "number", "Num"); /* 1 */
if (nr_printable_breakpoints > 0)
annotate_field (1);
- ui_out_table_header (uiout, print_type_col_width, ui_left,
- "type", "Type"); /* 2 */
+ uiout->table_header (print_type_col_width, ui_left, "type", "Type"); /* 2 */
if (nr_printable_breakpoints > 0)
annotate_field (2);
- ui_out_table_header (uiout, 4, ui_left, "disp", "Disp"); /* 3 */
+ uiout->table_header (4, ui_left, "disp", "Disp"); /* 3 */
if (nr_printable_breakpoints > 0)
annotate_field (3);
- ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */
+ uiout->table_header (3, ui_left, "enabled", "Enb"); /* 4 */
if (opts.addressprint)
{
if (nr_printable_breakpoints > 0)
annotate_field (4);
if (print_address_bits <= 32)
- ui_out_table_header (uiout, 10, ui_left,
- "addr", "Address"); /* 5 */
+ uiout->table_header (10, ui_left, "addr", "Address"); /* 5 */
else
- ui_out_table_header (uiout, 18, ui_left,
- "addr", "Address"); /* 5 */
+ uiout->table_header (18, ui_left, "addr", "Address"); /* 5 */
}
if (nr_printable_breakpoints > 0)
annotate_field (5);
- ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */
- ui_out_table_body (uiout);
+ uiout->table_header (40, ui_noalign, "what", "What"); /* 6 */
+ uiout->table_body ();
if (nr_printable_breakpoints > 0)
annotate_breakpoints_table ();
@@ -6954,10 +6943,9 @@ breakpoint_1 (char *args, int allflag,
if (!filter)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, "No breakpoints or watchpoints.\n");
+ uiout->message ("No breakpoints or watchpoints.\n");
else
- ui_out_message (uiout,
- "No breakpoint or watchpoint matching '%s'.\n",
+ uiout->message ("No breakpoint or watchpoint matching '%s'.\n",
args);
}
}
@@ -6990,9 +6978,9 @@ default_collect_info (void)
/* The following phrase lines up nicely with per-tracepoint collect
actions. */
- ui_out_text (uiout, "default collect ");
- ui_out_field_string (uiout, "default-collect", default_collect);
- ui_out_text (uiout, " \n");
+ uiout->text ("default collect ");
+ uiout->field_string ("default-collect", default_collect);
+ uiout->text (" \n");
}
static void
@@ -7012,9 +7000,9 @@ watchpoints_info (char *args, int from_tty)
if (num_printed == 0)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, "No watchpoints.\n");
+ uiout->message ("No watchpoints.\n");
else
- ui_out_message (uiout, "No watchpoint matching '%s'.\n", args);
+ uiout->message ("No watchpoint matching '%s'.\n", args);
}
}
@@ -8133,19 +8121,18 @@ print_it_catch_fork (bpstat bs)
annotate_catchpoint (b->number);
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary catchpoint ");
+ uiout->text ("Temporary catchpoint ");
else
- ui_out_text (uiout, "Catchpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Catchpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_FORK));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_FORK));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, " (forked process ");
- ui_out_field_int (uiout, "newpid", ptid_get_pid (c->forked_inferior_pid));
- ui_out_text (uiout, "), ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (" (forked process ");
+ uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+ uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -8165,19 +8152,18 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
line up too nicely with the headers, but the effect is relatively
readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
- ui_out_text (uiout, "fork");
+ uiout->text ("fork");
if (!ptid_equal (c->forked_inferior_pid, null_ptid))
{
- ui_out_text (uiout, ", process ");
- ui_out_field_int (uiout, "what",
- ptid_get_pid (c->forked_inferior_pid));
- ui_out_spaces (uiout, 1);
+ uiout->text (", process ");
+ uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+ uiout->spaces (1);
}
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "fork");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "fork");
}
/* Implement the "print_mention" breakpoint_ops method for fork
@@ -8251,19 +8237,18 @@ print_it_catch_vfork (bpstat bs)
annotate_catchpoint (b->number);
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary catchpoint ");
+ uiout->text ("Temporary catchpoint ");
else
- ui_out_text (uiout, "Catchpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Catchpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_VFORK));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_VFORK));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, " (vforked process ");
- ui_out_field_int (uiout, "newpid", ptid_get_pid (c->forked_inferior_pid));
- ui_out_text (uiout, "), ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (" (vforked process ");
+ uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+ uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -8282,19 +8267,18 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
line up too nicely with the headers, but the effect is relatively
readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
- ui_out_text (uiout, "vfork");
+ uiout->text ("vfork");
if (!ptid_equal (c->forked_inferior_pid, null_ptid))
{
- ui_out_text (uiout, ", process ");
- ui_out_field_int (uiout, "what",
- ptid_get_pid (c->forked_inferior_pid));
- ui_out_spaces (uiout, 1);
+ uiout->text (", process ");
+ uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+ uiout->spaces (1);
}
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "vfork");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "vfork");
}
/* Implement the "print_mention" breakpoint_ops method for vfork
@@ -8448,13 +8432,13 @@ print_it_catch_solib (bpstat bs)
annotate_catchpoint (b->number);
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary catchpoint ");
+ uiout->text ("Temporary catchpoint ");
else
- ui_out_text (uiout, "Catchpoint ");
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, "\n");
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->text ("Catchpoint ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text ("\n");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
print_solib_event (1);
return PRINT_SRC_AND_LOC;
}
@@ -8474,7 +8458,7 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
if (opts.addressprint)
{
annotate_field (4);
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
}
annotate_field (5);
@@ -8492,12 +8476,11 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
else
msg = xstrdup (_("unload of library"));
}
- ui_out_field_string (uiout, "what", msg);
+ uiout->field_string ("what", msg);
xfree (msg);
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type",
- self->is_load ? "load" : "unload");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
}
static void
@@ -8718,19 +8701,18 @@ print_it_catch_exec (bpstat bs)
annotate_catchpoint (b->number);
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary catchpoint ");
+ uiout->text ("Temporary catchpoint ");
else
- ui_out_text (uiout, "Catchpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Catchpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_EXEC));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_EXEC));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, " (exec'd ");
- ui_out_field_string (uiout, "new-exec", c->exec_pathname);
- ui_out_text (uiout, "), ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (" (exec'd ");
+ uiout->field_string ("new-exec", c->exec_pathname);
+ uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -8748,18 +8730,18 @@ print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc)
not line up too nicely with the headers, but the effect
is relatively readable). */
if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
- ui_out_text (uiout, "exec");
+ uiout->text ("exec");
if (c->exec_pathname != NULL)
{
- ui_out_text (uiout, ", program \"");
- ui_out_field_string (uiout, "what", c->exec_pathname);
- ui_out_text (uiout, "\" ");
+ uiout->text (", program \"");
+ uiout->field_string ("what", c->exec_pathname);
+ uiout->text ("\" ");
}
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "catch-type", "exec");
+ if (uiout->is_mi_like_p ())
+ uiout->field_string ("catch-type", "exec");
}
static void
@@ -9019,7 +9001,7 @@ static void
mention (struct breakpoint *b)
{
b->ops->print_mention (b);
- if (ui_out_is_mi_like_p (current_uiout))
+ if (current_uiout->is_mi_like_p ())
return;
printf_filtered ("\n");
}
@@ -10262,17 +10244,17 @@ print_it_ranged_breakpoint (bpstat bs)
maybe_print_thread_hit_breakpoint (uiout);
if (b->disposition == disp_del)
- ui_out_text (uiout, "Temporary ranged breakpoint ");
+ uiout->text ("Temporary ranged breakpoint ");
else
- ui_out_text (uiout, "Ranged breakpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Ranged breakpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
+ uiout->field_string ("reason",
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, ", ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (", ");
return PRINT_SRC_AND_LOC;
}
@@ -10296,7 +10278,7 @@ print_one_ranged_breakpoint (struct breakpoint *b,
if (opts.addressprint)
/* We don't print the address range here, it will be printed later
by print_one_detail_ranged_breakpoint. */
- ui_out_field_skip (uiout, "addr");
+ uiout->field_skip ("addr");
annotate_field (5);
print_breakpoint_location (b, bl);
*last_loc = bl;
@@ -10319,12 +10301,12 @@ print_one_detail_ranged_breakpoint (const struct breakpoint *b,
address_start = bl->address;
address_end = address_start + bl->length - 1;
- ui_out_text (uiout, "\taddress range: ");
+ uiout->text ("\taddress range: ");
fprintf_unfiltered (stb, "[%s, %s]",
print_core_address (bl->gdbarch, address_start),
print_core_address (bl->gdbarch, address_end));
- ui_out_field_stream (uiout, "addr", stb);
- ui_out_text (uiout, "\n");
+ uiout->field_stream ("addr", stb);
+ uiout->text ("\n");
do_cleanups (cleanup);
}
@@ -10341,7 +10323,7 @@ print_mention_ranged_breakpoint (struct breakpoint *b)
gdb_assert (bl);
gdb_assert (b->type == bp_hardware_breakpoint);
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
return;
printf_filtered (_("Hardware assisted ranged breakpoint %d from %s to %s."),
@@ -10778,64 +10760,62 @@ print_it_watchpoint (bpstat bs)
{
case bp_watchpoint:
case bp_hardware_watchpoint:
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
mention (b);
make_cleanup_ui_out_tuple_begin_end (uiout, "value");
- ui_out_text (uiout, "\nOld value = ");
+ uiout->text ("\nOld value = ");
watchpoint_value_print (bs->old_val, stb);
- ui_out_field_stream (uiout, "old", stb);
- ui_out_text (uiout, "\nNew value = ");
+ uiout->field_stream ("old", stb);
+ uiout->text ("\nNew value = ");
watchpoint_value_print (w->val, stb);
- ui_out_field_stream (uiout, "new", stb);
- ui_out_text (uiout, "\n");
+ uiout->field_stream ("new", stb);
+ uiout->text ("\n");
/* More than one watchpoint may have been triggered. */
result = PRINT_UNKNOWN;
break;
case bp_read_watchpoint:
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
mention (b);
make_cleanup_ui_out_tuple_begin_end (uiout, "value");
- ui_out_text (uiout, "\nValue = ");
+ uiout->text ("\nValue = ");
watchpoint_value_print (w->val, stb);
- ui_out_field_stream (uiout, "value", stb);
- ui_out_text (uiout, "\n");
+ uiout->field_stream ("value", stb);
+ uiout->text ("\n");
result = PRINT_UNKNOWN;
break;
case bp_access_watchpoint:
if (bs->old_val != NULL)
{
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason",
async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
mention (b);
make_cleanup_ui_out_tuple_begin_end (uiout, "value");
- ui_out_text (uiout, "\nOld value = ");
+ uiout->text ("\nOld value = ");
watchpoint_value_print (bs->old_val, stb);
- ui_out_field_stream (uiout, "old", stb);
- ui_out_text (uiout, "\nNew value = ");
+ uiout->field_stream ("old", stb);
+ uiout->text ("\nNew value = ");
}
else
{
mention (b);
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason",
async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
make_cleanup_ui_out_tuple_begin_end (uiout, "value");
- ui_out_text (uiout, "\nValue = ");
+ uiout->text ("\nValue = ");
}
watchpoint_value_print (w->val, stb);
- ui_out_field_stream (uiout, "new", stb);
- ui_out_text (uiout, "\n");
+ uiout->field_stream ("new", stb);
+ uiout->text ("\n");
result = PRINT_UNKNOWN;
break;
default:
@@ -10859,19 +10839,19 @@ print_mention_watchpoint (struct breakpoint *b)
switch (b->type)
{
case bp_watchpoint:
- ui_out_text (uiout, "Watchpoint ");
+ uiout->text ("Watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
break;
case bp_hardware_watchpoint:
- ui_out_text (uiout, "Hardware watchpoint ");
+ uiout->text ("Hardware watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
break;
case bp_read_watchpoint:
- ui_out_text (uiout, "Hardware read watchpoint ");
+ uiout->text ("Hardware read watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
break;
case bp_access_watchpoint:
- ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
+ uiout->text ("Hardware access (read/write) watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
break;
default:
@@ -10879,9 +10859,9 @@ print_mention_watchpoint (struct breakpoint *b)
_("Invalid hardware watchpoint type."));
}
- ui_out_field_int (uiout, "number", b->number);
- ui_out_text (uiout, ": ");
- ui_out_field_string (uiout, "exp", w->exp_string);
+ uiout->field_int ("number", b->number);
+ uiout->text (": ");
+ uiout->field_string ("exp", w->exp_string);
do_cleanups (ui_out_chain);
}
@@ -10994,23 +10974,21 @@ print_it_masked_watchpoint (bpstat bs)
switch (b->type)
{
case bp_hardware_watchpoint:
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
break;
case bp_read_watchpoint:
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
- async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
break;
case bp_access_watchpoint:
- if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string
- (uiout, "reason",
+ if (uiout->is_mi_like_p ())
+ uiout->field_string
+ ("reason",
async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
break;
default:
@@ -11019,10 +10997,10 @@ print_it_masked_watchpoint (bpstat bs)
}
mention (b);
- ui_out_text (uiout, _("\n\
+ uiout->text (_("\n\
Check the underlying instruction at PC for the memory\n\
address and value which triggered this watchpoint.\n"));
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
/* More than one watchpoint may have been triggered. */
return PRINT_UNKNOWN;
@@ -11040,9 +11018,9 @@ print_one_detail_masked_watchpoint (const struct breakpoint *b,
/* Masked watchpoints have only one location. */
gdb_assert (b->loc && b->loc->next == NULL);
- ui_out_text (uiout, "\tmask ");
- ui_out_field_core_addr (uiout, "mask", b->loc->gdbarch, w->hw_wp_mask);
- ui_out_text (uiout, "\n");
+ uiout->text ("\tmask ");
+ uiout->field_core_addr ("mask", b->loc->gdbarch, w->hw_wp_mask);
+ uiout->text ("\n");
}
/* Implement the "print_mention" breakpoint_ops method for
@@ -11058,15 +11036,15 @@ print_mention_masked_watchpoint (struct breakpoint *b)
switch (b->type)
{
case bp_hardware_watchpoint:
- ui_out_text (uiout, "Masked hardware watchpoint ");
+ uiout->text ("Masked hardware watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
break;
case bp_read_watchpoint:
- ui_out_text (uiout, "Masked hardware read watchpoint ");
+ uiout->text ("Masked hardware read watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
break;
case bp_access_watchpoint:
- ui_out_text (uiout, "Masked hardware access (read/write) watchpoint ");
+ uiout->text ("Masked hardware access (read/write) watchpoint ");
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
break;
default:
@@ -11074,9 +11052,9 @@ print_mention_masked_watchpoint (struct breakpoint *b)
_("Invalid hardware watchpoint type."));
}
- ui_out_field_int (uiout, "number", b->number);
- ui_out_text (uiout, ": ");
- ui_out_field_string (uiout, "exp", w->exp_string);
+ uiout->field_int ("number", b->number);
+ uiout->text (": ");
+ uiout->field_string ("exp", w->exp_string);
do_cleanups (ui_out_chain);
}
@@ -13173,17 +13151,17 @@ bkpt_print_it (bpstat bs)
maybe_print_thread_hit_breakpoint (uiout);
if (bp_temp)
- ui_out_text (uiout, "Temporary breakpoint ");
+ uiout->text ("Temporary breakpoint ");
else
- ui_out_text (uiout, "Breakpoint ");
- if (ui_out_is_mi_like_p (uiout))
+ uiout->text ("Breakpoint ");
+ if (uiout->is_mi_like_p ())
{
- ui_out_field_string (uiout, "reason",
+ uiout->field_string ("reason",
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
- ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition));
+ uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- ui_out_field_int (uiout, "bkptno", b->number);
- ui_out_text (uiout, ", ");
+ uiout->field_int ("bkptno", b->number);
+ uiout->text (", ");
return PRINT_SRC_AND_LOC;
}
@@ -13191,7 +13169,7 @@ bkpt_print_it (bpstat bs)
static void
bkpt_print_mention (struct breakpoint *b)
{
- if (ui_out_is_mi_like_p (current_uiout))
+ if (current_uiout->is_mi_like_p ())
return;
switch (b->type)
@@ -13507,17 +13485,17 @@ tracepoint_print_one_detail (const struct breakpoint *self,
{
gdb_assert (self->type == bp_static_tracepoint);
- ui_out_text (uiout, "\tmarker id is ");
- ui_out_field_string (uiout, "static-tracepoint-marker-string-id",
+ uiout->text ("\tmarker id is ");
+ uiout->field_string ("static-tracepoint-marker-string-id",
tp->static_trace_marker_id);
- ui_out_text (uiout, "\n");
+ uiout->text ("\n");
}
}
static void
tracepoint_print_mention (struct breakpoint *b)
{
- if (ui_out_is_mi_like_p (current_uiout))
+ if (current_uiout->is_mi_like_p ())
return;
switch (b->type)
@@ -14157,26 +14135,25 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
sal2 = find_pc_line (tpmarker->address, 0);
sym = find_pc_sect_function (tpmarker->address, NULL);
- ui_out_text (uiout, "Now in ");
+ uiout->text ("Now in ");
if (sym)
{
- ui_out_field_string (uiout, "func",
- SYMBOL_PRINT_NAME (sym));
- ui_out_text (uiout, " at ");
+ uiout->field_string ("func", SYMBOL_PRINT_NAME (sym));
+ uiout->text (" at ");
}
- ui_out_field_string (uiout, "file",
+ uiout->field_string ("file",
symtab_to_filename_for_display (sal2.symtab));
- ui_out_text (uiout, ":");
+ uiout->text (":");
- if (ui_out_is_mi_like_p (uiout))
+ if (uiout->is_mi_like_p ())
{
const char *fullname = symtab_to_fullname (sal2.symtab);
- ui_out_field_string (uiout, "fullname", fullname);
+ uiout->field_string ("fullname", fullname);
}
- ui_out_field_int (uiout, "line", sal2.line);
- ui_out_text (uiout, "\n");
+ uiout->field_int ("line", sal2.line);
+ uiout->text ("\n");
b->loc->line_number = sal2.line;
b->loc->symtab = sym != NULL ? sal2.symtab : NULL;
@@ -15470,9 +15447,9 @@ tracepoints_info (char *args, int from_tty)
if (num_printed == 0)
{
if (args == NULL || *args == '\0')
- ui_out_message (uiout, "No tracepoints.\n");
+ uiout->message ("No tracepoints.\n");
else
- ui_out_message (uiout, "No tracepoint matching '%s'.\n", args);
+ uiout->message ("No tracepoint matching '%s'.\n", args);
}
default_collect_info ();
@@ -15763,19 +15740,19 @@ save_breakpoints (char *filename, int from_tty,
{
fprintf_unfiltered (fp, " commands\n");
- ui_out_redirect (current_uiout, fp);
+ current_uiout->redirect (fp);
TRY
{
print_command_lines (current_uiout, tp->commands->commands, 2);
}
CATCH (ex, RETURN_MASK_ALL)
{
- ui_out_redirect (current_uiout, NULL);
+ current_uiout->redirect (NULL);
throw_exception (ex);
}
END_CATCH
- ui_out_redirect (current_uiout, NULL);
+ current_uiout->redirect (NULL);
fprintf_unfiltered (fp, " end\n");
}
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index f5b5072..af983a1 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -26,163 +26,107 @@
#include "completer.h"
#include "readline/readline.h"
-typedef struct cli_ui_out_data cli_out_data;
-
-/* Prototypes for local functions */
-
-static void cli_text (struct ui_out *uiout, const char *string);
-
-static void field_separator (void);
-
-static void out_field_fmt (struct ui_out *uiout, int fldno,
- const char *fldname,
- const char *format,...) ATTRIBUTE_PRINTF (4, 5);
-
-/* The destructor. */
-
-static void
-cli_uiout_dtor (struct ui_out *ui_out)
-{
- cli_out_data *data = (cli_out_data *) ui_out_data (ui_out);
-
- delete data;
-}
-
/* These are the CLI output functions */
/* Mark beginning of a table */
-static void
-cli_table_begin (struct ui_out *uiout, int nbrofcols,
- int nr_rows,
- const char *tblid)
+void
+cli_ui_out::do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
if (nr_rows == 0)
- data->suppress_output = 1;
+ m_suppress_output = true;
else
/* Only the table suppresses the output and, fortunately, a table
is not a recursive data structure. */
- gdb_assert (data->suppress_output == 0);
+ gdb_assert (!m_suppress_output);
}
/* Mark beginning of a table body */
-static void
-cli_table_body (struct ui_out *uiout)
+void
+cli_ui_out::do_table_body ()
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
+
/* first, close the table header line */
- cli_text (uiout, "\n");
+ text ("\n");
}
/* Mark end of a table */
-static void
-cli_table_end (struct ui_out *uiout)
+void
+cli_ui_out::do_table_end ()
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- data->suppress_output = 0;
+ m_suppress_output = false;
}
/* Specify table header */
-static void
-cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
- const std::string &col_name, const std::string &col_hdr)
+void
+cli_ui_out::do_table_header (int width, ui_align alignment,
+ const std::string &col_name,
+ const std::string &col_hdr)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- /* Always go through the function pointer (virtual function call).
- We may have been extended. */
- uo_field_string (uiout, 0, width, alignment, 0, col_hdr.c_str ());
+ do_field_string (0, width, alignment, 0, col_hdr.c_str ());
}
/* Mark beginning of a list */
-static void
-cli_begin (struct ui_out *uiout,
- enum ui_out_type type,
- const char *id)
+void
+cli_ui_out::do_begin (ui_out_type type, const char *id)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
- return;
}
/* Mark end of a list */
-static void
-cli_end (struct ui_out *uiout,
- enum ui_out_type type)
+void
+cli_ui_out::do_end (ui_out_type type)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
- return;
}
/* output an int field */
-static void
-cli_field_int (struct ui_out *uiout, int fldno, int width,
- enum ui_align alignment,
- const char *fldname, int value)
+void
+cli_ui_out::do_field_int (int fldno, int width, ui_align alignment,
+ const char *fldname, int value)
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- if (data->suppress_output)
+ if (m_suppress_output)
return;
+
xsnprintf (buffer, sizeof (buffer), "%d", value);
- /* Always go through the function pointer (virtual function call).
- We may have been extended. */
- uo_field_string (uiout, fldno, width, alignment, fldname, buffer);
+ do_field_string (fldno, width, alignment, fldname, buffer);
}
-/* used to ommit a field */
+/* used to omit a field */
-static void
-cli_field_skip (struct ui_out *uiout, int fldno, int width,
- enum ui_align alignment,
- const char *fldname)
+void
+cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
+ const char *fldname)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- /* Always go through the function pointer (virtual function call).
- We may have been extended. */
- uo_field_string (uiout, fldno, width, alignment, fldname, "");
+ do_field_string (fldno, width, alignment, fldname, "");
}
/* other specific cli_field_* end up here so alignment and field
separators are both handled by cli_field_string */
-static void
-cli_field_string (struct ui_out *uiout,
- int fldno,
- int width,
- enum ui_align align,
- const char *fldname,
- const char *string)
+void
+cli_ui_out::do_field_string (int fldno, int width, ui_align align,
+ const char *fldname, const char *string)
{
int before = 0;
int after = 0;
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- if (data->suppress_output)
+ if (m_suppress_output)
return;
if ((align != ui_noalign) && string)
@@ -209,11 +153,13 @@ cli_field_string (struct ui_out *uiout,
}
if (before)
- ui_out_spaces (uiout, before);
+ spaces (before);
+
if (string)
- out_field_fmt (uiout, fldno, fldname, "%s", string);
+ out_field_fmt (fldno, fldname, "%s", string);
+
if (after)
- ui_out_spaces (uiout, after);
+ spaces (after);
if (align != ui_noalign)
field_separator ();
@@ -221,188 +167,131 @@ cli_field_string (struct ui_out *uiout,
/* This is the only field function that does not align. */
-static void ATTRIBUTE_PRINTF (6, 0)
-cli_field_fmt (struct ui_out *uiout, int fldno,
- int width, enum ui_align align,
- const char *fldname,
- const char *format,
- va_list args)
+void
+cli_ui_out::do_field_fmt (int fldno, int width, ui_align align,
+ const char *fldname, const char *format,
+ va_list args)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *stream;
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- stream = data->streams.back ();
- vfprintf_filtered (stream, format, args);
+ vfprintf_filtered (m_streams.back (), format, args);
if (align != ui_noalign)
field_separator ();
}
-static void
-cli_spaces (struct ui_out *uiout, int numspaces)
+void
+cli_ui_out::do_spaces (int numspaces)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *stream;
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- stream = data->streams.back ();
- print_spaces_filtered (numspaces, stream);
+ print_spaces_filtered (numspaces, m_streams.back ());
}
-static void
-cli_text (struct ui_out *uiout, const char *string)
+void
+cli_ui_out::do_text (const char *string)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *stream;
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- stream = data->streams.back ();
- fputs_filtered (string, stream);
+ fputs_filtered (string, m_streams.back ());
}
-static void ATTRIBUTE_PRINTF (2, 0)
-cli_message (struct ui_out *uiout, const char *format, va_list args)
+void
+cli_ui_out::do_message (const char *format, va_list args)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
- struct ui_file *stream = data->streams.back ();
- vfprintf_unfiltered (stream, format, args);
+ vfprintf_unfiltered (m_streams.back (), format, args);
}
-static void
-cli_wrap_hint (struct ui_out *uiout, const char *identstring)
+void
+cli_ui_out::do_wrap_hint (const char *identstring)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
- if (data->suppress_output)
+ if (m_suppress_output)
return;
+
wrap_here (identstring);
}
-static void
-cli_flush (struct ui_out *uiout)
+void
+cli_ui_out::do_flush ()
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *stream = data->streams.back ();
-
- gdb_flush (stream);
+ gdb_flush (m_streams.back ());
}
/* OUTSTREAM as non-NULL will push OUTSTREAM on the stack of output streams
and make it therefore active. OUTSTREAM as NULL will pop the last pushed
output stream; it is an internal error if it does not exist. */
-static int
-cli_redirect (struct ui_out *uiout, struct ui_file *outstream)
+int
+cli_ui_out::do_redirect (ui_file *outstream)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
-
if (outstream != NULL)
- data->streams.push_back (outstream);
+ m_streams.push_back (outstream);
else
- data->streams.pop_back ();
+ m_streams.pop_back ();
return 0;
}
/* local functions */
-/* Like cli_field_fmt, but takes a variable number of args
+/* Like cli_ui_out::do_field_fmt, but takes a variable number of args
and makes a va_list and does not insert a separator. */
/* VARARGS */
-static void
-out_field_fmt (struct ui_out *uiout, int fldno,
- const char *fldname,
- const char *format,...)
+void
+cli_ui_out::out_field_fmt (int fldno, const char *fldname,
+ const char *format, ...)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *stream = data->streams.back ();
va_list args;
va_start (args, format);
- vfprintf_filtered (stream, format, args);
+ vfprintf_filtered (m_streams.back (), format, args);
va_end (args);
}
-/* Access to ui_out format private members. */
-
-static void
-field_separator (void)
+void
+cli_ui_out::field_separator ()
{
- cli_out_data *data = (cli_out_data *) ui_out_data (current_uiout);
- struct ui_file *stream = data->streams.back ();
-
- fputc_filtered (' ', stream);
+ fputc_filtered (' ', m_streams.back ());
}
-/* This is the CLI ui-out implementation functions vector */
+/* Constructor for cli_ui_out. */
-const struct ui_out_impl cli_ui_out_impl =
-{
- cli_table_begin,
- cli_table_body,
- cli_table_end,
- cli_table_header,
- cli_begin,
- cli_end,
- cli_field_int,
- cli_field_skip,
- cli_field_string,
- cli_field_fmt,
- cli_spaces,
- cli_text,
- cli_message,
- cli_wrap_hint,
- cli_flush,
- cli_redirect,
- cli_uiout_dtor,
- 0, /* Does not need MI hacks (i.e. needs CLI hacks). */
-};
-
-/* Constructor for a `cli_out_data' object. */
-
-void
-cli_out_data_ctor (cli_out_data *self, struct ui_file *stream)
+cli_ui_out::cli_ui_out (ui_file *stream, ui_out_flags flags)
+: ui_out (flags),
+ m_suppress_output (false)
{
gdb_assert (stream != NULL);
- self->streams.push_back (stream);
+ m_streams.push_back (stream);
+}
- self->suppress_output = 0;
+cli_ui_out::~cli_ui_out ()
+{
}
/* Initialize private members at startup. */
-struct ui_out *
+cli_ui_out *
cli_out_new (struct ui_file *stream)
{
- ui_out_flags flags = ui_source_list;
- cli_out_data *data = new cli_out_data ();
-
- cli_out_data_ctor (data, stream);
- return ui_out_new (&cli_ui_out_impl, data, flags);
+ return new cli_ui_out (stream, ui_source_list);
}
-struct ui_file *
-cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
+ui_file *
+cli_ui_out::set_stream (struct ui_file *stream)
{
- cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
- struct ui_file *old;
+ ui_file *old;
- old = data->streams.back ();
- data->streams.back () = stream;
+ old = m_streams.back ();
+ m_streams.back () = stream;
return old;
}
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index 296b8c0..ef996c4 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -23,25 +23,59 @@
#include "ui-out.h"
#include <vector>
-/* These are exported so that they can be extended by other `ui_out'
- implementations, like TUI's. */
+class cli_ui_out : public ui_out
+{
+public:
-struct cli_ui_out_data
- {
- std::vector<ui_file *> streams;
- int suppress_output;
- };
+ explicit cli_ui_out (ui_file *stream, ui_out_flags flags);
+ virtual ~cli_ui_out ();
-extern const struct ui_out_impl cli_ui_out_impl;
+ ui_file *set_stream (ui_file *stream);
+protected:
-extern struct ui_out *cli_out_new (struct ui_file *stream);
+ virtual void do_table_begin (int nbrofcols, int nr_rows,
+ const char *tblid) override;
+ virtual void do_table_body () override;
+ virtual void do_table_end () override;
+ virtual void do_table_header (int width, ui_align align,
+ const std::string &col_name,
+ const std::string &col_hdr) override;
+ /* Note: level 0 is the top-level so LEVEL is always greater than
+ zero. */
+ virtual void do_begin (ui_out_type type, const char *id) override;
+ virtual void do_end (ui_out_type type) override;
+ virtual void do_field_int (int fldno, int width, ui_align align,
+ const char *fldname, int value) override;
+ virtual void do_field_skip (int fldno, int width, ui_align align,
+ const char *fldname) override;
+ virtual void do_field_string (int fldno, int width, ui_align align,
+ const char *fldname, const char *string) override;
+ virtual void do_field_fmt (int fldno, int width, ui_align align,
+ const char *fldname, const char *format, va_list args)
+ override ATTRIBUTE_PRINTF (6,0);
+ virtual void do_spaces (int numspaces) override;
+ virtual void do_text (const char *string) override;
+ virtual void do_message (const char *format, va_list args) override
+ ATTRIBUTE_PRINTF (2,0);
+ virtual void do_wrap_hint (const char *identstring) override;
+ virtual void do_flush () override;
+ virtual int do_redirect (struct ui_file * outstream) override;
-extern void cli_out_data_ctor (struct cli_ui_out_data *data,
- struct ui_file *stream);
+ bool suppress_output ()
+ { return m_suppress_output; }
-extern struct ui_file *cli_out_set_stream (struct ui_out *uiout,
- struct ui_file *stream);
+private:
+
+ void field_separator ();
+ void out_field_fmt (int fldno, const char *fldname, const char *format, ...)
+ ATTRIBUTE_PRINTF (4, 5);
+
+ std::vector<ui_file *> m_streams;
+ bool m_suppress_output;
+};
+
+extern cli_ui_out *cli_out_new (struct ui_file *stream);
extern void cli_display_match_list (char **matches, int len, int max);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 3d1a628..763a6d4 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -254,7 +254,7 @@ complete_command (char *arg, int from_tty)
{
/* Only print this for non-mi frontends. An MI frontend may not
be able to handle this. */
- if (!ui_out_is_mi_like_p (current_uiout))
+ if (!current_uiout->is_mi_like_p ())
{
printf_unfiltered (_("max-completions is zero,"
" completion is disabled.\n"));
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index dfa96d6..3e6a2fd 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -34,7 +34,7 @@
struct cli_interp
{
/* The ui_out for the console interpreter. */
- struct ui_out *cli_uiout;
+ cli_ui_out *cli_uiout;
};
/* Suppress notification struct. */
@@ -281,10 +281,10 @@ cli_interpreter_resume (void *data)
previously writing to gdb_stdout, then set it to the new
gdb_stdout afterwards. */
- stream = cli_out_set_stream (cli->cli_uiou[...]
[diff truncated at 100000 bytes]