From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 4/5] Use ui_out_emit_tuple in more places in MI
Date: Fri, 14 Apr 2017 02:42:00 -0000 [thread overview]
Message-ID: <20170414022337.28368-5-tom@tromey.com> (raw)
In-Reply-To: <20170414022337.28368-1-tom@tromey.com>
This patch changes a few more spots in MI to use ui_out_emit_tuple.
These changes required the use of gdb::optional.
gdb/ChangeLog
2017-04-13 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.
---
gdb/ChangeLog | 6 ++++++
gdb/mi/mi-cmd-stack.c | 9 +++------
gdb/mi/mi-cmd-var.c | 7 +++----
gdb/mi/mi-main.c | 7 ++-----
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ba91cdc..e972b4c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2017-04-13 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-13 Tom Tromey <tom@tromey.com>
+
* tracepoint.c (tvariables_info_1)
(print_one_static_tracepoint_marker): Use ui_out_emit_tuple.
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index f288817..bd24e5b 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -34,6 +34,7 @@
#include "extension.h"
#include <ctype.h>
#include "mi-parse.h"
+#include "common/gdb_optional.h"
enum what_to_list { locals, arguments, all };
@@ -483,7 +484,6 @@ static void
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);
@@ -507,10 +507,9 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
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;
@@ -556,8 +555,6 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
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,
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 0a4ed62..1a7e322 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -30,6 +30,7 @@
#include "mi-getopt.h"
#include "gdbthread.h"
#include "mi-parse.h"
+#include "common/gdb_optional.h"
extern unsigned int varobjdebug; /* defined in varobj.c. */
@@ -712,10 +713,10 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
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)
@@ -784,8 +785,6 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
VEC_free (varobj_p, r->newobj);
r->newobj = NULL; /* Paranoia. */
}
-
- do_cleanups (cleanup);
}
VEC_free (varobj_update_result, changes);
}
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<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)
@@ -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. */
--
2.9.3
next prev parent reply other threads:[~2017-04-14 2:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 2:23 [RFA 0/5] some cleanup removal for ui_out Tom Tromey
2017-04-14 2:23 ` [RFA 3/5] Use ui_out_emit_tuple in tracepoint.c Tom Tromey
2017-04-18 18:43 ` Pedro Alves
2017-04-14 2:23 ` [RFA 5/5] Use ui_out_emit_list Tom Tromey
2017-04-18 18:44 ` Pedro Alves
2017-04-14 2:23 ` [RFA 2/5] More uses of ui_out_emit_tuple Tom Tromey
2017-04-18 18:42 ` Pedro Alves
2017-04-19 2:42 ` Tom Tromey
2017-04-19 9:39 ` Pedro Alves
2017-04-14 2:24 ` [RFA 1/5] Use ui_out_emit_tuple Tom Tromey
2017-04-18 18:42 ` Pedro Alves
2017-04-14 2:42 ` Tom Tromey [this message]
2017-04-18 18:44 ` [RFA 4/5] Use ui_out_emit_tuple in more places in MI Pedro Alves
2017-04-22 15:44 ` [RFA 0/5] some cleanup removal for ui_out Tom Tromey
2017-04-27 14:51 ` Simon Marchi
2017-04-27 21:23 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170414022337.28368-5-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox