From 2e78302469502f4f8a98144b60c09d4d9b6438fd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 12 Apr 2017 08:23:08 -0600 Subject: Use ui_out_emit_tuple This patch changes various places to use ui_out_emit_tuple, eliminating a number of cleanups. This patch only tackles "easy" cases, which are ones where the cleanups in question were block-structured and did not involve any changes other than the obvious replacement. ChangeLog 2017-04-22 Tom Tromey * record-btrace.c (record_btrace_insn_history) (record_btrace_insn_history_range, record_btrace_call_history) (record_btrace_call_history_range): Use ui_out_emit_tuple. * thread.c (do_captured_list_thread_ids, print_thread_info_1): Use ui_out_emit_tuple. * stack.c (print_frame_info): Use ui_out_emit_tuple. * solib.c (info_sharedlibrary_command): Use ui_out_emit_tuple. * skip.c (skip_info): Use ui_out_emit_tuple. * remote.c (show_remote_cmd): Use ui_out_emit_tuple. * progspace.c (print_program_space): Use ui_out_emit_tuple. * probe.c (info_probes_for_ops): Use ui_out_emit_tuple. * osdata.c (info_osdata): Use ui_out_emit_tuple. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Use ui_out_emit_tuple. * mi/mi-main.c (print_one_inferior, list_available_thread_groups) (output_register, mi_cmd_data_read_memory) (mi_cmd_data_read_memory_bytes, mi_load_progress) (mi_cmd_trace_frame_collected): Use ui_out_emit_tuple. * mi/mi-cmd-var.c (mi_cmd_var_list_children, varobj_update_one): Use ui_out_emit_tuple. * mi/mi-cmd-stack.c (mi_cmd_stack_list_args): Use ui_out_emit_tuple. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions) (mi_cmd_info_gdb_mi_command): Use ui_out_emit_tuple. * linux-thread-db.c (info_auto_load_libthread_db): Use ui_out_emit_tuple. * inferior.c (print_inferior): Use ui_out_emit_tuple. * gdb_bfd.c (print_one_bfd): Use ui_out_emit_tuple. * disasm.c (do_mixed_source_and_assembly_deprecated) (do_mixed_source_and_assembly): Use ui_out_emit_tuple. * cp-abi.c (list_cp_abis): Use ui_out_emit_tuple. * cli/cli-setshow.c (cmd_show_list): Use ui_out_emit_tuple. * breakpoint.c (print_one_breakpoint_location) (print_one_breakpoint): Use ui_out_emit_tuple. * auto-load.c (print_script, info_auto_load_cmd): Use ui_out_emit_tuple. * ada-tasks.c (print_ada_task_info): Use ui_out_emit_tuple. --- gdb/cli/cli-setshow.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 218e1f3..fb0bd49 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -664,32 +664,27 @@ do_show_command (const char *arg, int from_tty, struct cmd_list_element *c) void cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix) { - struct cleanup *showlist_chain; struct ui_out *uiout = current_uiout; - showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist"); + ui_out_emit_tuple tuple_emitter (uiout, "showlist"); for (; list != NULL; list = list->next) { /* If we find a prefix, run its list, prefixing our output by its prefix (with "show " skipped). */ if (list->prefixlist && !list->abbrev_flag) { - struct cleanup *optionlist_chain - = make_cleanup_ui_out_tuple_begin_end (uiout, "optionlist"); + ui_out_emit_tuple optionlist_emitter (uiout, "optionlist"); const char *new_prefix = strstr (list->prefixname, "show ") + 5; if (uiout->is_mi_like_p ()) uiout->field_string ("prefix", new_prefix); cmd_show_list (*list->prefixlist, from_tty, new_prefix); - /* Close the tuple. */ - do_cleanups (optionlist_chain); } else { if (list->theclass != no_set_class) { - struct cleanup *option_chain - = make_cleanup_ui_out_tuple_begin_end (uiout, "option"); + ui_out_emit_tuple option_emitter (uiout, "option"); uiout->text (prefix); uiout->field_string ("name", list->name); @@ -698,12 +693,8 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix) do_show_command ((char *) NULL, from_tty, list); else cmd_func (list, NULL, from_tty); - /* Close the tuple. */ - do_cleanups (option_chain); } } } - /* Close the tuple. */ - do_cleanups (showlist_chain); } -- cgit v1.1