static void
output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
{
- struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (uiout,
- field_name);
- char *cores = xstrdup (xcores);
- char *p = cores;
-
- make_cleanup (xfree, cores);
+ ui_out_emit_list list_emitter (uiout, field_name);
+ gdb::unique_xmalloc_ptr<char> cores (xstrdup (xcores));
+ char *p = cores.get ();
for (p = strtok (p, ","); p; p = strtok (NULL, ","))
uiout->field_string (NULL, p);
-
- do_cleanups (back_to);
}
static void
}
}
- make_cleanup_ui_out_list_begin_end (uiout, "groups");
+ ui_out_emit_list list_emitter (uiout, "groups");
for (ix_items = 0;
VEC_iterate (osdata_item_s, data->items,
struct osdata_item *child;
int ix_child;
- make_cleanup_ui_out_list_begin_end (uiout, "threads");
+ ui_out_emit_list thread_list_emitter (uiout, "threads");
for (ix_child = 0;
VEC_iterate (osdata_item_s, children, ix_child, child);
print everything, or several explicit ids. In both cases,
we print more than one group, and have to use 'groups'
as the top-level element. */
- make_cleanup_ui_out_list_begin_end (uiout, "groups");
+ ui_out_emit_list list_emitter (uiout, "groups");
update_thread_list ();
iterate_over_inferiors (print_one_inferior, &data);
}
gdbarch = get_regcache_arch (this_regs);
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
- make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
+ ui_out_emit_list list_emitter (uiout, "changed-registers");
if (argc == 0)
{
{
int row;
int row_byte;
- struct cleanup *cleanup_list;
string_file stream;
- cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, "memory");
+ ui_out_emit_list list_emitter (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
row++, row_byte += nr_cols * word_size)
{
int col;
int col_byte;
- struct cleanup *cleanup_list_data;
struct value_print_options opts;
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); */
- cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data");
- get_formatted_print_options (&opts, word_format);
- for (col = 0, col_byte = row_byte;
- col < nr_cols;
- col++, col_byte += word_size)
- {
- if (col_byte + word_size > nr_bytes)
- {
- uiout->field_string (NULL, "N/A");
- }
- else
- {
- stream.clear ();
- print_scalar_formatted (&mbuf[col_byte], word_type, &opts,
- word_asize, &stream);
- uiout->field_stream (NULL, stream);
- }
- }
- do_cleanups (cleanup_list_data);
+ {
+ ui_out_emit_list list_data_emitter (uiout, "data");
+ get_formatted_print_options (&opts, word_format);
+ for (col = 0, col_byte = row_byte;
+ col < nr_cols;
+ col++, col_byte += word_size)
+ {
+ if (col_byte + word_size > nr_bytes)
+ {
+ uiout->field_string (NULL, "N/A");
+ }
+ else
+ {
+ stream.clear ();
+ print_scalar_formatted (&mbuf[col_byte], word_type, &opts,
+ word_asize, &stream);
+ uiout->field_stream (NULL, stream);
+ }
+ }
+ }
+
if (aschar)
{
int byte;
uiout->field_stream ("ascii", stream);
}
}
- do_cleanups (cleanup_list);
}
}
if (VEC_length (memory_read_result_s, result) == 0)
error (_("Unable to read memory."));
- make_cleanup_ui_out_list_begin_end (uiout, "memory");
+ ui_out_emit_list list_emitter (uiout, "memory");
for (ix = 0;
VEC_iterate (memory_read_result_s, result, ix, read_result);
++ix)
/* Trace state variables. */
{
- struct cleanup *list_cleanup;
+ struct cleanup *cleanups;
int tvar;
char *tsvname;
int i;
- list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "tvars");
+ ui_out_emit_list list_emitter (uiout, "tvars");
tsvname = NULL;
- make_cleanup (free_current_contents, &tsvname);
+ cleanups = make_cleanup (free_current_contents, &tsvname);
for (i = 0; VEC_iterate (int, tinfo->tvars, i, tvar); i++)
{
}
}
- do_cleanups (list_cleanup);
+ do_cleanups (cleanups);
}
/* Memory. */
{
- struct cleanup *list_cleanup;
+ struct cleanup *cleanups;
VEC(mem_range_s) *available_memory = NULL;
struct mem_range *r;
int i;
traceframe_available_memory (&available_memory, 0, ULONGEST_MAX);
- make_cleanup (VEC_cleanup(mem_range_s), &available_memory);
+ cleanups = make_cleanup (VEC_cleanup(mem_range_s), &available_memory);
- list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "memory");
+ ui_out_emit_list list_emitter (uiout, "memory");
for (i = 0; VEC_iterate (mem_range_s, available_memory, i, r); i++)
{
}
}
- do_cleanups (list_cleanup);
+ do_cleanups (cleanups);
}
}