+2017-04-22 Tom Tromey <tom@tromey.com>
+
+ * mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Use
+ ui_out_emit_list.
+ * stack.c (print_frame): Use ui_out_emit_list.
+ * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Use
+ ui_out_emit_list.
+ * mi/mi-main.c (print_one_inferior)
+ (mi_cmd_data_list_register_names)
+ (mi_cmd_data_list_register_values, mi_cmd_list_features)
+ (mi_cmd_list_target_features, mi_cmd_trace_frame_collected): Use
+ ui_out_emit_list.
+ * mi/mi-interp.c (mi_on_normal_stop_1): Use ui_out_emit_list.
+ (mi_output_solib_attribs): Use ui_out_emit_list,
+ ui_out_emit_tuple.
+ * mi/mi-cmd-var.c (varobj_update_one): Use ui_out_emit_list.
+ * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
+ (mi_cmd_stack_list_args, list_args_or_locals): Use
+ ui_out_emit_list.
+ * disasm.c (do_assembly_only): Use ui_out_emit_list.
+ * breakpoint.c (print_solib_event, output_thread_groups): Use
+ ui_out_emit_list.
+
2017-04-22 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (print_variable_or_computed): Use ui_out_emit_tuple.
if (any_deleted)
{
- struct cleanup *cleanup;
char *name;
int ix;
current_uiout->text (_(" Inferior unloaded "));
- cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
- "removed");
+ ui_out_emit_list list_emitter (current_uiout, "removed");
for (ix = 0;
VEC_iterate (char_ptr, current_program_space->deleted_solibs,
ix, name);
current_uiout->field_string ("library", name);
current_uiout->text ("\n");
}
-
- do_cleanups (cleanup);
}
if (any_added)
{
struct so_list *iter;
int ix;
- struct cleanup *cleanup;
current_uiout->text (_(" Inferior loaded "));
- cleanup = make_cleanup_ui_out_list_begin_end (current_uiout,
- "added");
+ ui_out_emit_list list_emitter (current_uiout, "added");
for (ix = 0;
VEC_iterate (so_list_ptr, current_program_space->added_solibs,
ix, iter);
current_uiout->field_string ("library", iter->so_name);
current_uiout->text ("\n");
}
-
- do_cleanups (cleanup);
}
}
VEC(int) *inf_num,
int mi_only)
{
- struct cleanup *back_to;
int is_mi = uiout->is_mi_like_p ();
int inf;
int i;
if (!is_mi && mi_only)
return;
- back_to = make_cleanup_ui_out_list_begin_end (uiout, field_name);
+ ui_out_emit_list list_emitter (uiout, field_name);
for (i = 0; VEC_iterate (int, inf_num, i, inf); ++i)
{
uiout->text (plongest (inf));
}
}
-
- do_cleanups (back_to);
}
/* Print B to gdb_stdout. */
CORE_ADDR low, CORE_ADDR high,
int how_many, int flags)
{
- struct cleanup *ui_out_chain;
-
- ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
+ ui_out_emit_list list_emitter (uiout, "asm_insns");
dump_insns (gdbarch, uiout, low, high, how_many, flags, NULL);
-
- do_cleanups (ui_out_chain);
}
/* Initialize the disassemble info struct ready for the specified
update_solib_list (1);
/* Print the table header. */
- struct cleanup *cleanup
- = make_cleanup_ui_out_list_begin_end (uiout, "shared-libraries");
+ ui_out_emit_list list_emitter (uiout, "shared-libraries");
ALL_SO_LIBS (so)
{
do_cleanups (tuple_clean_up);
}
-
- do_cleanups (cleanup);
}
int frame_low;
int frame_high;
int i;
- struct cleanup *cleanup_stack;
struct frame_info *fi;
enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
int raw_arg = 0;
if (fi == NULL)
error (_("-stack-list-frames: Not enough frames in stack."));
- cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack");
+ ui_out_emit_list list_emitter (current_uiout, "stack");
if (! raw_arg && frame_filters)
{
print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
}
}
-
- do_cleanups (cleanup_stack);
}
void
int frame_high;
int i;
struct frame_info *fi;
- struct cleanup *cleanup_stack_args;
enum print_values print_values;
struct ui_out *uiout = current_uiout;
int raw_arg = 0;
if (fi == NULL)
error (_("-stack-list-arguments: Not enough frames in stack."));
- cleanup_stack_args
- = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
+ ui_out_emit_list list_emitter (uiout, "stack-args");
if (! raw_arg && frame_filters)
{
list_args_or_locals (arguments, print_values, fi, skip_unavailable);
}
}
- do_cleanups (cleanup_stack_args);
}
/* Print a list of the local variables (including arguments) for the
const struct block *block;
struct symbol *sym;
struct block_iterator iter;
- struct cleanup *cleanup_list;
struct type *type;
const char *name_of_result;
struct ui_out *uiout = current_uiout;
"unexpected what_to_list: %d", (int) what);
}
- cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, name_of_result);
+ ui_out_emit_list list_emitter (uiout, name_of_result);
while (block != 0)
{
else
block = BLOCK_SUPERBLOCK (block);
}
- do_cleanups (cleanup_list);
}
void
{
int j;
varobj_p child;
- struct cleanup *cleanup;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children");
+ ui_out_emit_list list_emitter (uiout, "new_children");
for (j = 0; VEC_iterate (varobj_p, r->newobj, j, child); ++j)
{
ui_out_emit_tuple tuple_emitter (uiout, NULL);
print_varobj (child, print_values, 1 /* print_expression */);
}
- do_cleanups (cleanup);
VEC_free (varobj_p, r->newobj);
r->newobj = NULL; /* Paranoia. */
}
mi_uiout->field_int ("thread-id", tp->global_num);
if (non_stop)
{
- struct cleanup *back_to = make_cleanup_ui_out_list_begin_end
- (mi_uiout, "stopped-threads");
+ ui_out_emit_list list_emitter (mi_uiout, "stopped-threads");
mi_uiout->field_int (NULL, tp->global_num);
- do_cleanups (back_to);
}
else
mi_uiout->field_string ("stopped-threads", "all");
if (!gdbarch_has_global_solist (target_gdbarch ()))
uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
- struct cleanup *cleanup
- = make_cleanup_ui_out_list_begin_end (uiout, "ranges");
- struct cleanup *tuple_clean_up
- = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ ui_out_emit_list list_emitter (uiout, "ranges");
+ ui_out_emit_tuple tuple_emitter (uiout, NULL);
if (solib->addr_high != 0)
{
uiout->field_core_addr ("from", gdbarch, solib->addr_low);
uiout->field_core_addr ("to", gdbarch, solib->addr_high);
}
- do_cleanups (tuple_clean_up);
- do_cleanups (cleanup);
}
static void
if (!VEC_empty (int, data.cores))
{
int *b, *e;
- struct cleanup *back_to_2 =
- make_cleanup_ui_out_list_begin_end (uiout, "cores");
+ ui_out_emit_list list_emitter (uiout, "cores");
qsort (VEC_address (int, data.cores),
VEC_length (int, data.cores), sizeof (int),
for (; b != e; ++b)
uiout->field_int (NULL, *b);
-
- do_cleanups (back_to_2);
}
if (top_data->recurse)
struct ui_out *uiout = current_uiout;
int regnum, numregs;
int i;
- struct cleanup *cleanup;
/* Note that the test for a valid register must include checking the
gdbarch_register_name because gdbarch_num_regs may be allocated
gdbarch = get_current_arch ();
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-names");
+ ui_out_emit_list list_emitter (uiout, "register-names");
if (argc == 0) /* No args, just do all the regs. */
{
else
uiout->field_string (NULL, gdbarch_register_name (gdbarch, regnum));
}
- do_cleanups (cleanup);
}
void
struct gdbarch *gdbarch;
int regnum, numregs, format;
int i;
- struct cleanup *list_cleanup;
int skip_unavailable = 0;
int oind = 0;
enum opt
gdbarch = get_frame_arch (frame);
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
- list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values");
+ ui_out_emit_list list_emitter (uiout, "register-values");
if (argc - oind == 1)
{
else
error (_("bad register number"));
}
- do_cleanups (list_cleanup);
}
/* Output one register REGNUM's contents in the desired FORMAT. If
{
if (argc == 0)
{
- struct cleanup *cleanup = NULL;
struct ui_out *uiout = current_uiout;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
+ ui_out_emit_list list_emitter (uiout, "features");
uiout->field_string (NULL, "frozen-varobjs");
uiout->field_string (NULL, "pending-breakpoints");
uiout->field_string (NULL, "thread-info");
if (ext_lang_initialized_p (get_ext_lang_defn (EXT_LANG_PYTHON)))
uiout->field_string (NULL, "python");
- do_cleanups (cleanup);
return;
}
{
if (argc == 0)
{
- struct cleanup *cleanup = NULL;
struct ui_out *uiout = current_uiout;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
+ ui_out_emit_list list_emitter (uiout, "features");
if (mi_async_p ())
uiout->field_string (NULL, "async");
if (target_can_execute_reverse)
uiout->field_string (NULL, "reverse");
- do_cleanups (cleanup);
return;
}
/* Explicitly wholly collected variables. */
{
- struct cleanup *list_cleanup;
int i;
- list_cleanup = make_cleanup_ui_out_list_begin_end (uiout,
- "explicit-variables");
-
+ ui_out_emit_list list_emitter (uiout, "explicit-variables");
const std::vector<std::string> &wholly_collected
= clist->wholly_collected ();
for (size_t i = 0; i < wholly_collected.size (); i++)
const std::string &str = wholly_collected[i];
print_variable_or_computed (str.c_str (), var_print_values);
}
-
- do_cleanups (list_cleanup);
}
/* Computed expressions. */
{
- struct cleanup *list_cleanup;
char *p;
int i;
- list_cleanup
- = make_cleanup_ui_out_list_begin_end (uiout,
- "computed-expressions");
+ ui_out_emit_list list_emitter (uiout, "computed-expressions");
const std::vector<std::string> &computed = clist->computed ();
for (size_t i = 0; i < computed.size (); i++)
const std::string &str = computed[i];
print_variable_or_computed (str.c_str (), comp_print_values);
}
-
- do_cleanups (list_cleanup);
}
/* Registers. Given pseudo-registers, and that some architectures
the trace frame info, but instead consult the register cache for
register availability. */
{
- struct cleanup *list_cleanup;
struct frame_info *frame;
struct gdbarch *gdbarch;
int regnum;
int numregs;
- list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "registers");
+ ui_out_emit_list list_emitter (uiout, "registers");
frame = get_selected_frame (NULL);
gdbarch = get_frame_arch (frame);
output_register (frame, regnum, registers_format, 1);
}
-
- do_cleanups (list_cleanup);
}
/* Trace state variables. */
char *filename;
struct symtab *s;
int i;
- struct cleanup *cleanup_stack;
struct ui_out *uiout = current_uiout;
if (argc != 1)
need to perform any other sorting. */
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
- cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
+ ui_out_emit_list list_emitter (uiout, "lines");
if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++)
{
uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc);
uiout->field_int ("line", SYMTAB_LINETABLE (s)->item[i].line);
}
-
- do_cleanups (cleanup_stack);
}
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int numargs;
- struct cleanup *args_list_chain;
if (gdbarch_frame_num_args_p (gdbarch))
{
else
numargs = -1;
- args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
- TRY
- {
- print_frame_args (func, frame, numargs, gdb_stdout);
- }
- CATCH (e, RETURN_MASK_ERROR)
- {
- }
- END_CATCH
+ {
+ ui_out_emit_list list_emitter (uiout, "args");
+ TRY
+ {
+ print_frame_args (func, frame, numargs, gdb_stdout);
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
- /* FIXME: ARGS must be a list. If one argument is a string it
- will have " that will not be properly escaped. */
- /* Invoke ui_out_tuple_end. */
- do_cleanups (args_list_chain);
+ /* FIXME: ARGS must be a list. If one argument is a string it
+ will have " that will not be properly escaped. */
+ }
QUIT;
}
uiout->text (")");