- nb_tasks = VEC_length (ada_task_info_s, data->task_list);
-
- nb_columns = ui_out_is_mi_like_p (uiout) ? 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");
+ nb_tasks = data->task_list.size ();
+
+ nb_columns = uiout->is_mi_like_p () ? 8 : 7;
+ ui_out_emit_table table_emitter (uiout, nb_columns, nb_tasks, "tasks");
+ uiout->table_header (1, ui_left, "current", "");
+ uiout->table_header (3, ui_right, "id", "ID");
+ {
+ size_t tid_width = 9;
+ /* Grown below in case the largest entry is bigger. */
+
+ if (!uiout->is_mi_like_p ())
+ {
+ for (taskno = 1; taskno <= data->task_list.size (); taskno++)
+ {
+ const struct ada_task_info *const task_info
+ = &data->task_list[taskno - 1];
+
+ gdb_assert (task_info != NULL);
+
+ tid_width = std::max (tid_width,
+ 1 + strlen (phex_nz (task_info->task_id,
+ sizeof (CORE_ADDR))));
+ }
+ }
+ uiout->table_header (tid_width, ui_right, "task-id", "TID");
+ }