From 0092b74da6d86185c4d0c0fa0f540b97647bf44a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 12 Apr 2017 16:16:10 -0600 Subject: Use ui_out_emit_tuple in more places in MI This patch changes a few more spots in MI to use ui_out_emit_tuple. These changes required the use of gdb::optional. ChangeLog 2017-04-22 Tom Tromey * mi/mi-main.c (print_variable_or_computed): Use ui_out_emit_tuple. * mi/mi-cmd-var.c (varobj_update_one): Use ui_out_emit_tuple. * mi/mi-cmd-stack.c (list_arg_or_local): Use ui_out_emit_tuple. --- gdb/mi/mi-main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gdb/mi/mi-main.c') diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index d309ba3..7e225db 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2656,7 +2656,6 @@ mi_cmd_ada_task_info (const char *command, char **argv, int argc) static void print_variable_or_computed (const char *expression, enum print_values values) { - struct cleanup *old_chain; struct value *val; struct type *type; struct ui_out *uiout = current_uiout; @@ -2670,9 +2669,9 @@ print_variable_or_computed (const char *expression, enum print_values values) else val = evaluate_expression (expr.get ()); - old_chain = make_cleanup (null_cleanup, NULL); + gdb::optional tuple_emitter; if (values != PRINT_NO_VALUES) - make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + tuple_emitter.emplace (uiout, nullptr); uiout->field_string ("name", expression); switch (values) @@ -2704,8 +2703,6 @@ print_variable_or_computed (const char *expression, enum print_values values) } break; } - - do_cleanups (old_chain); } /* Implement the "-trace-frame-collected" command. */ -- cgit v1.1