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 <tom@tromey.com>
* 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.
+2017-04-22 Tom Tromey <tom@tromey.com>
+
+ * 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.
+
2017-04-22 Tom Tromey <tom@tromey.com>
* tracepoint.c (tvariables_info_1)
#include "extension.h"
#include <ctype.h>
#include "mi-parse.h"
+#include "common/gdb_optional.h"
enum what_to_list { locals, arguments, all };
list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
enum print_values values, int skip_unavailable)
{
- struct cleanup *old_chain;
struct ui_out *uiout = current_uiout;
gdb_assert (!arg->val || !arg->error);
TYPE_LENGTH (value_type (arg->val))))))
return;
- old_chain = make_cleanup (null_cleanup, NULL);
-
+ gdb::optional<ui_out_emit_tuple> tuple_emitter;
if (values != PRINT_NO_VALUES || what == all)
- make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ tuple_emitter.emplace (uiout, nullptr);
string_file stb;
stb.printf (_("<error reading variable: %s>"), error_message);
uiout->field_stream ("value", stb);
}
-
- do_cleanups (old_chain);
}
/* Print a list of the objects for the frame FI in a certain form,
#include "mi-getopt.h"
#include "gdbthread.h"
#include "mi-parse.h"
+#include "common/gdb_optional.h"
extern unsigned int varobjdebug; /* defined in varobj.c. */
for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i)
{
int from, to;
- struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+ gdb::optional<ui_out_emit_tuple> tuple_emitter;
if (mi_version (uiout) > 1)
- make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ tuple_emitter.emplace (uiout, nullptr);
uiout->field_string ("name", varobj_get_objname (r->varobj));
switch (r->status)
VEC_free (varobj_p, r->newobj);
r->newobj = NULL; /* Paranoia. */
}
-
- do_cleanups (cleanup);
}
VEC_free (varobj_update_result, changes);
}
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;
else
val = evaluate_expression (expr.get ());
- old_chain = make_cleanup (null_cleanup, NULL);
+ gdb::optional<ui_out_emit_tuple> 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)
}
break;
}
-
- do_cleanups (old_chain);
}
/* Implement the "-trace-frame-collected" command. */