aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorDenis Pilat <denis.pilat@st.com>2007-02-13 08:15:49 +0000
committerDenis Pilat <denis.pilat@st.com>2007-02-13 08:15:49 +0000
commit8756216bc74d2a014779aaebf3cbb6f220cc4583 (patch)
tree3d8f139c33a1ab5110aac49188048e58f9963c00 /gdb/mi
parentb1e374737bca6da4311e2be8b0cc9133599dfad1 (diff)
downloadgdb-8756216bc74d2a014779aaebf3cbb6f220cc4583.zip
gdb-8756216bc74d2a014779aaebf3cbb6f220cc4583.tar.gz
gdb-8756216bc74d2a014779aaebf3cbb6f220cc4583.tar.bz2
2007-02-13 Denis Pilat <denis.pilat@st.com>
* varobj.h (enum varobj_update_error): New enum. * varobj.c (struct varobj_root): Add is_valid member. (varobj_get_type): Check for invalid varobj. (varobj_get_attributes): Likewise. (variable_editable):Likewise. (varobj_update): Likewise. Use varobj_update_error. (new_root_variable): Set root varobj as valid by default. (varobj_invalidate): New function. * symfile.c (clear_symtab_users): Use varobj_invalidate. * mi/mi-cmd-var.c (varobj_update_one): Change return type to void. Use varobj_update_error.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-var.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 2cf9e08..270a771 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -34,9 +34,9 @@ const char mi_no_values[] = "--no-values";
const char mi_simple_values[] = "--simple-values";
const char mi_all_values[] = "--all-values";
-extern int varobjdebug; /* defined in varobj.c */
+extern int varobjdebug; /* defined in varobj.c. */
-static int varobj_update_one (struct varobj *var,
+static void varobj_update_one (struct varobj *var,
enum print_values print_values);
static int mi_print_value_p (struct type *type, enum print_values print_values);
@@ -535,11 +535,9 @@ mi_cmd_var_update (char *command, char **argv, int argc)
return MI_CMD_DONE;
}
-/* Helper for mi_cmd_var_update() Returns 0 if the update for
- the variable fails (usually because the variable is out of
- scope), and 1 if it succeeds. */
+/* Helper for mi_cmd_var_update(). */
-static int
+static void
varobj_update_one (struct varobj *var, enum print_values print_values)
{
struct varobj **changelist;
@@ -549,37 +547,39 @@ varobj_update_one (struct varobj *var, enum print_values print_values)
nc = varobj_update (&var, &changelist);
- /* nc == 0 means that nothing has changed.
- nc == -1 means that an error occured in updating the variable.
- nc == -2 means the variable has changed type. */
+ /* nc >= 0 represents the number of changes reported into changelist.
+ nc < 0 means that an error occured or the the variable has
+ changed type (TYPE_CHANGED). */
if (nc == 0)
- return 1;
- else if (nc == -1)
+ return;
+ else if (nc < 0)
{
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));
+
+ switch (nc)
+ {
+ case NOT_IN_SCOPE:
+ case WRONG_PARAM:
+ ui_out_field_string (uiout, "in_scope", "false");
+ break;
+ case INVALID:
+ ui_out_field_string (uiout, "in_scope", "invalid");
+ break;
+ case TYPE_CHANGED:
+ 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));
+ break;
+ }
if (mi_version (uiout) > 1)
do_cleanups (cleanup);
}
else
{
-
cc = changelist;
while (*cc != NULL)
{
@@ -595,7 +595,5 @@ varobj_update_one (struct varobj *var, enum print_values print_values)
cc++;
}
xfree (changelist);
- return 1;
}
- return 1;
}