From 3a387118ebf549c974c7badd16a0751ab3c32417 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 3 Oct 2002 20:02:13 +0000 Subject: 2002-10-03 Jeff Johnston * 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. --- gdb/mi/mi-cmd-var.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'gdb/mi/mi-cmd-var.c') 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); -- cgit v1.1