aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-12 08:23:08 -0600
committerTom Tromey <tom@tromey.com>2017-04-22 09:46:58 -0600
commit2e78302469502f4f8a98144b60c09d4d9b6438fd (patch)
tree83731a2a166c64c77a427975eb13f05339f2e3cb /gdb/thread.c
parenta8cc8a548eccdfd78ad76c826339f56db815bdb8 (diff)
downloadgdb-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/thread.c')
-rw-r--r--gdb/thread.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 7ce65ff..d08f414 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -718,26 +718,25 @@ do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
{
struct thread_info *tp;
int num = 0;
- struct cleanup *cleanup_chain;
int current_thread = -1;
update_thread_list ();
- cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "thread-ids");
-
- for (tp = thread_list; tp; tp = tp->next)
- {
- if (tp->state == THREAD_EXITED)
- continue;
+ {
+ ui_out_emit_tuple tuple_emitter (uiout, "thread-ids");
- if (tp->ptid == inferior_ptid)
- current_thread = tp->global_num;
+ for (tp = thread_list; tp; tp = tp->next)
+ {
+ if (tp->state == THREAD_EXITED)
+ continue;
- num++;
- uiout->field_int ("thread-id", tp->global_num);
- }
+ if (tp->ptid == inferior_ptid)
+ current_thread = tp->global_num;
- do_cleanups (cleanup_chain);
+ num++;
+ uiout->field_int ("thread-id", tp->global_num);
+ }
+ }
if (current_thread != -1)
uiout->field_int ("current-thread-id", current_thread);
@@ -1299,14 +1298,13 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
ALL_THREADS_BY_INFERIOR (inf, tp)
{
- struct cleanup *chain2;
int core;
if (!should_print_thread (requested_threads, default_inf_num,
global_ids, pid, tp))
continue;
- chain2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout, NULL);
if (!uiout->is_mi_like_p ())
{
@@ -1386,8 +1384,6 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
core = target_core_of_thread (tp->ptid);
if (uiout->is_mi_like_p () && core != -1)
uiout->field_int ("core", core);
-
- do_cleanups (chain2);
}
/* Restores the current thread and the frame selected before