aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-var.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-10-03 20:02:13 +0000
committerJeff Johnston <jjohnstn@redhat.com>2002-10-03 20:02:13 +0000
commit3a387118ebf549c974c7badd16a0751ab3c32417 (patch)
tree5567e096b9d09446aa3b7e18df40fd7ae6239a13 /gdb/mi/mi-cmd-var.c
parent8607b6c98d6b9af877240405471108d0d5a6c77f (diff)
downloadgdb-3a387118ebf549c974c7badd16a0751ab3c32417.zip
gdb-3a387118ebf549c974c7badd16a0751ab3c32417.tar.gz
gdb-3a387118ebf549c974c7badd16a0751ab3c32417.tar.bz2
2002-10-03 Jeff Johnston <jjohnstn@redhat.com>
* mi-cmd-var.c (mi_cmd_var_update): Fix for PR gdb/672. For m2, output list begin and end for "changelist" rather than tuple begin/end. (varobj_update_one): For m2, add tuple begin and end for varobj update output.
Diffstat (limited to 'gdb/mi/mi-cmd-var.c')
-rw-r--r--gdb/mi/mi-cmd-var.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index cb5e939..1149066 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -405,6 +405,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
struct varobj *var;
struct varobj **rootlist;
struct varobj **cr;
+ struct cleanup *cleanup;
char *name;
int nv;
@@ -419,10 +420,13 @@ mi_cmd_var_update (char *command, char **argv, int argc)
if ((*name == '*') && (*(name + 1) == '\0'))
{
nv = varobj_list (&rootlist);
- ui_out_tuple_begin (uiout, "changelist");
+ if (mi_version (uiout) <= 1)
+ cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
+ else
+ cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
if (nv <= 0)
{
- ui_out_tuple_end (uiout);
+ do_cleanups (cleanup);
return MI_CMD_DONE;
}
cr = rootlist;
@@ -432,7 +436,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
cr++;
}
xfree (rootlist);
- ui_out_tuple_end (uiout);
+ do_cleanups (cleanup);
}
else
{
@@ -441,9 +445,12 @@ mi_cmd_var_update (char *command, char **argv, int argc)
if (var == NULL)
error ("mi_cmd_var_update: Variable object not found");
- ui_out_tuple_begin (uiout, "changelist");
+ if (mi_version (uiout) <= 1)
+ cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
+ else
+ cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
varobj_update_one (var);
- ui_out_tuple_end (uiout);
+ do_cleanups (cleanup);
}
return MI_CMD_DONE;
}
@@ -457,6 +464,7 @@ varobj_update_one (struct varobj *var)
{
struct varobj **changelist;
struct varobj **cc;
+ struct cleanup *cleanup = NULL;
int nc;
nc = varobj_update (&var, &changelist);
@@ -469,17 +477,25 @@ varobj_update_one (struct varobj *var)
return 1;
else if (nc == -1)
{
+ if (mi_version (uiout) > 1)
+ cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", varobj_get_objname(var));
ui_out_field_string (uiout, "in_scope", "false");
+ if (mi_version (uiout) > 1)
+ do_cleanups (cleanup);
return -1;
}
else if (nc == -2)
{
+ if (mi_version (uiout) > 1)
+ cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", varobj_get_objname (var));
ui_out_field_string (uiout, "in_scope", "true");
ui_out_field_string (uiout, "new_type", varobj_get_type(var));
ui_out_field_int (uiout, "new_num_children",
varobj_get_num_children(var));
+ if (mi_version (uiout) > 1)
+ do_cleanups (cleanup);
}
else
{
@@ -487,9 +503,13 @@ varobj_update_one (struct varobj *var)
cc = changelist;
while (*cc != NULL)
{
+ if (mi_version (uiout) > 1)
+ cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
ui_out_field_string (uiout, "in_scope", "true");
ui_out_field_string (uiout, "type_changed", "false");
+ if (mi_version (uiout) > 1)
+ do_cleanups (cleanup);
cc++;
}
xfree (changelist);