diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-12 08:23:08 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-04-22 09:46:58 -0600 |
commit | 2e78302469502f4f8a98144b60c09d4d9b6438fd (patch) | |
tree | 83731a2a166c64c77a427975eb13f05339f2e3cb /gdb/mi/mi-main.c | |
parent | a8cc8a548eccdfd78ad76c826339f56db815bdb8 (diff) | |
download | gdb-2e78302469502f4f8a98144b60c09d4d9b6438fd.zip gdb-2e78302469502f4f8a98144b60c09d4d9b6438fd.tar.gz gdb-2e78302469502f4f8a98144b60c09d4d9b6438fd.tar.bz2 |
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 <tom@tromey.com>
* 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.
Diffstat (limited to 'gdb/mi/mi-main.c')
-rw-r--r-- | gdb/mi/mi-main.c | 63 |
1 files changed, 21 insertions, 42 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index c3e7bf7..d309ba3 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -660,8 +660,7 @@ print_one_inferior (struct inferior *inferior, void *xdata) compare_positive_ints)) { struct collect_cores_data data; - struct cleanup *back_to - = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_fmt ("id", "i%d", inferior->num); uiout->field_string ("type", "process"); @@ -706,8 +705,6 @@ print_one_inferior (struct inferior *inferior, void *xdata) if (top_data->recurse) print_thread_info (uiout, NULL, inferior->pid); - - do_cleanups (back_to); } return 0; @@ -831,8 +828,6 @@ list_available_thread_groups (VEC (int) *ids, int recurse) ix_items, item); ix_items++) { - struct cleanup *back_to; - const char *pid = get_osdata_column (item, "pid"); const char *cmd = get_osdata_column (item, "command"); const char *user = get_osdata_column (item, "user"); @@ -849,7 +844,7 @@ list_available_thread_groups (VEC (int) *ids, int recurse) continue; - back_to = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_fmt ("id", "%s", pid); uiout->field_string ("type", "process"); @@ -875,21 +870,16 @@ list_available_thread_groups (VEC (int) *ids, int recurse) VEC_iterate (osdata_item_s, children, ix_child, child); ++ix_child) { - struct cleanup *back_to_2 = - make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); const char *tid = get_osdata_column (child, "tid"); const char *tcore = get_osdata_column (child, "core"); uiout->field_string ("id", tid); if (tcore) uiout->field_string ("core", tcore); - - do_cleanups (back_to_2); } } } - - do_cleanups (back_to); } do_cleanups (cleanup); @@ -1257,13 +1247,12 @@ output_register (struct frame_info *frame, int regnum, int format, { struct ui_out *uiout = current_uiout; struct value *val = value_of_register (regnum, frame); - struct cleanup *tuple_cleanup; struct value_print_options opts; if (skip_unavailable && !value_entirely_available (val)) return; - tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_int ("number", regnum); if (format == 'N') @@ -1280,8 +1269,6 @@ output_register (struct frame_info *frame, int regnum, int format, value_embedded_offset (val), 0, &stb, 0, val, &opts, current_language); uiout->field_stream ("value", stb); - - do_cleanups (tuple_cleanup); } /* Write given values into registers. The registers and values are @@ -1520,11 +1507,10 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc) { int col; int col_byte; - struct cleanup *cleanup_tuple; struct cleanup *cleanup_list_data; struct value_print_options opts; - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_core_addr ("addr", gdbarch, addr + row_byte); /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */ @@ -1564,7 +1550,6 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc) } uiout->field_stream ("ascii", stream); } - do_cleanups (cleanup_tuple); } do_cleanups (cleanup_list); } @@ -1629,7 +1614,7 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc) VEC_iterate (memory_read_result_s, result, ix, read_result); ++ix) { - struct cleanup *t = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); char *data, *p; int i; int alloc_len; @@ -1649,7 +1634,6 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc) } uiout->field_string ("contents", data); xfree (data); - do_cleanups (t); } do_cleanups (cleanups); } @@ -2385,19 +2369,18 @@ mi_load_progress (const char *section_name, strcmp (previous_sect_name, section_name) : 1); if (new_section) { - struct cleanup *cleanup_tuple; - xfree (previous_sect_name); previous_sect_name = xstrdup (section_name); if (current_token) fputs_unfiltered (current_token, mi->raw_stdout); fputs_unfiltered ("+download", mi->raw_stdout); - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - uiout->field_string ("section", section_name); - uiout->field_int ("section-size", total_section); - uiout->field_int ("total-size", grand_total); - do_cleanups (cleanup_tuple); + { + ui_out_emit_tuple tuple_emitter (uiout, NULL); + uiout->field_string ("section", section_name); + uiout->field_int ("section-size", total_section); + uiout->field_int ("total-size", grand_total); + } mi_out_put (uiout, mi->raw_stdout); fputs_unfiltered ("\n", mi->raw_stdout); gdb_flush (mi->raw_stdout); @@ -2406,19 +2389,18 @@ mi_load_progress (const char *section_name, steady_clock::time_point time_now = steady_clock::now (); if (time_now - last_update > milliseconds (500)) { - struct cleanup *cleanup_tuple; - last_update = time_now; if (current_token) fputs_unfiltered (current_token, mi->raw_stdout); fputs_unfiltered ("+download", mi->raw_stdout); - cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - uiout->field_string ("section", section_name); - uiout->field_int ("section-sent", sent_so_far); - uiout->field_int ("section-size", total_section); - uiout->field_int ("total-sent", total_sent); - uiout->field_int ("total-size", grand_total); - do_cleanups (cleanup_tuple); + { + ui_out_emit_tuple tuple_emitter (uiout, NULL); + uiout->field_string ("section", section_name); + uiout->field_int ("section-sent", sent_so_far); + uiout->field_int ("section-size", total_section); + uiout->field_int ("total-sent", total_sent); + uiout->field_int ("total-size", grand_total); + } mi_out_put (uiout, mi->raw_stdout); fputs_unfiltered ("\n", mi->raw_stdout); gdb_flush (mi->raw_stdout); @@ -2888,12 +2870,11 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc) for (i = 0; VEC_iterate (int, tinfo->tvars, i, tvar); i++) { - struct cleanup *cleanup_child; struct trace_state_variable *tsv; tsv = find_trace_state_variable_by_number (tvar); - cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_emit_tuple tuple_emitter (uiout, NULL); if (tsv != NULL) { @@ -2911,8 +2892,6 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc) uiout->field_skip ("name"); uiout->field_skip ("current"); } - - do_cleanups (cleanup_child); } do_cleanups (list_cleanup); |