aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-12 16:30:21 -0600
committerTom Tromey <tom@tromey.com>2017-04-22 09:47:01 -0600
commit10f489e57677e670bf980e93896762594e9ad908 (patch)
treebaaeb8059b91d5eac4e0b633f65d6b64f220d114 /gdb/mi
parent0092b74da6d86185c4d0c0fa0f540b97647bf44a (diff)
downloadgdb-10f489e57677e670bf980e93896762594e9ad908.zip
gdb-10f489e57677e670bf980e93896762594e9ad908.tar.gz
gdb-10f489e57677e670bf980e93896762594e9ad908.tar.bz2
Use ui_out_emit_list
This changes some spots to use ui_out_emit_list. This only touches "easy" cases, where the cleanup was used in a block-structured way. There's also one more use of ui_out_emit_tuple in here. ChangeLog 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.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-file.c5
-rw-r--r--gdb/mi/mi-cmd-stack.c14
-rw-r--r--gdb/mi/mi-cmd-var.c4
-rw-r--r--gdb/mi/mi-interp.c12
-rw-r--r--gdb/mi/mi-main.c40
-rw-r--r--gdb/mi/mi-symbol-cmds.c5
6 files changed, 17 insertions, 63 deletions
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index d166ff6..2b3522b 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -144,8 +144,7 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
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)
{
@@ -160,6 +159,4 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
do_cleanups (tuple_clean_up);
}
-
- do_cleanups (cleanup);
}
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index bd24e5b..6250b75 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -82,7 +82,6 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
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;
@@ -143,7 +142,7 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
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)
{
@@ -177,8 +176,6 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
}
}
-
- do_cleanups (cleanup_stack);
}
void
@@ -291,7 +288,6 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
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;
@@ -359,8 +355,7 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
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)
{
@@ -394,7 +389,6 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
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
@@ -570,7 +564,6 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
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;
@@ -593,7 +586,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
"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)
{
@@ -681,7 +674,6 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
else
block = BLOCK_SUPERBLOCK (block);
}
- do_cleanups (cleanup_list);
}
void
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 1a7e322..191e770 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -772,16 +772,14 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
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. */
}
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index a769fe9..959ae37 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -680,11 +680,9 @@ mi_on_normal_stop_1 (struct bpstats *bs, int print_frame)
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");
@@ -1128,17 +1126,13 @@ mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
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
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 7e225db..cb68fd6 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -686,8 +686,7 @@ print_one_inferior (struct inferior *inferior, void *xdata)
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),
@@ -699,8 +698,6 @@ print_one_inferior (struct inferior *inferior, void *xdata)
for (; b != e; ++b)
uiout->field_int (NULL, *b);
-
- do_cleanups (back_to_2);
}
if (top_data->recurse)
@@ -994,7 +991,6 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc)
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
@@ -1006,7 +1002,7 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc)
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. */
{
@@ -1035,7 +1031,6 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc)
else
uiout->field_string (NULL, gdbarch_register_name (gdbarch, regnum));
}
- do_cleanups (cleanup);
}
void
@@ -1157,7 +1152,6 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
struct gdbarch *gdbarch;
int regnum, numregs, format;
int i;
- struct cleanup *list_cleanup;
int skip_unavailable = 0;
int oind = 0;
enum opt
@@ -1204,7 +1198,7 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
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)
{
@@ -1234,7 +1228,6 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
else
error (_("bad register number"));
}
- do_cleanups (list_cleanup);
}
/* Output one register REGNUM's contents in the desired FORMAT. If
@@ -1830,10 +1823,9 @@ mi_cmd_list_features (const char *command, char **argv, int argc)
{
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");
@@ -1848,7 +1840,6 @@ mi_cmd_list_features (const char *command, char **argv, int argc)
if (ext_lang_initialized_p (get_ext_lang_defn (EXT_LANG_PYTHON)))
uiout->field_string (NULL, "python");
- do_cleanups (cleanup);
return;
}
@@ -1860,15 +1851,13 @@ mi_cmd_list_target_features (const char *command, char **argv, int argc)
{
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;
}
@@ -2787,12 +2776,9 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
/* 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++)
@@ -2800,19 +2786,14 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
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++)
@@ -2820,8 +2801,6 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
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
@@ -2829,13 +2808,12 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
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);
@@ -2849,8 +2827,6 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
output_register (frame, regnum, registers_format, 1);
}
-
- do_cleanups (list_cleanup);
}
/* Trace state variables. */
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index f9e464d..ea17af7 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -33,7 +33,6 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
char *filename;
struct symtab *s;
int i;
- struct cleanup *cleanup_stack;
struct ui_out *uiout = current_uiout;
if (argc != 1)
@@ -50,8 +49,8 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
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++)
{
@@ -59,6 +58,4 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
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);
}