aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2007-04-14 09:51:30 +0000
committerVladimir Prus <vladimir@codesourcery.com>2007-04-14 09:51:30 +0000
commit25d5ea921bee4a06522b807e33912e2345bb1086 (patch)
treebf7e66e01ebe4b3aa974d50cf84f7953bcdd6a8f /gdb/mi
parent4d115fc687decb37191c284a0dd422210466ba57 (diff)
downloadgdb-25d5ea921bee4a06522b807e33912e2345bb1086.zip
gdb-25d5ea921bee4a06522b807e33912e2345bb1086.tar.gz
gdb-25d5ea921bee4a06522b807e33912e2345bb1086.tar.bz2
* varobj.h (varobj_set_frozen): New
(varobj_get_frozen): New. (varobj_update): New parameter explicit. * varobj.c (struct varobj): New fields frozen and not_fetched. (varobj_set_frozen, varobj_get_frozen): New. (install_new_value): Don't fetch values for frozen variable object, or children thereof. Allow a frozen variable object to have non-fetched value. (varobj_update): Allow updating child variables. Don't traverse frozen children. (new_variable): Initialize the frozen field. (c_value_of_variable): Return NULL for frozen variable without any value yet. * mi/mi-cmd-var.c (varobj_update_one): New parameter 'explicit'. (mi_cmd_var_create): Output the 'frozen' field, as soon as testsuite is adjusted to expect that field. (mi_cmd_var_set_frozen): New. (mi_cmd_var_update): Pass the 'explicit' parameter to varobj_update_one. * mi/mi-cmds.c (mi_cmds): Register '-var-set-frozen'. * mi/mi-cmds.h (mi_cmd_var_set_frozen): Declare.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-var.c44
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
3 files changed, 41 insertions, 5 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 9ae37db..c3801ad 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -37,7 +37,8 @@ const char mi_all_values[] = "--all-values";
extern int varobjdebug; /* defined in varobj.c. */
static void varobj_update_one (struct varobj *var,
- enum print_values print_values);
+ enum print_values print_values,
+ int explicit);
static int mi_print_value_p (struct type *type, enum print_values print_values);
@@ -64,6 +65,9 @@ print_varobj (struct varobj *var, enum print_values print_values,
ui_out_field_string (uiout, "type", type);
xfree (type);
}
+
+ if (varobj_get_frozen (var))
+ ui_out_field_int (uiout, "frozen", 1);
}
/* VAROBJ operations */
@@ -233,6 +237,35 @@ mi_cmd_var_set_format (char *command, char **argv, int argc)
}
enum mi_cmd_result
+mi_cmd_var_set_frozen (char *command, char **argv, int argc)
+{
+ struct varobj *var;
+ int frozen;
+
+ if (argc != 2)
+ error (_("-var-set-format: Usage: NAME FROZEN_FLAG."));
+
+ var = varobj_get_handle (argv[0]);
+ if (var == NULL)
+ error (_("Variable object not found"));
+
+ if (strcmp (argv[1], "0") == 0)
+ frozen = 0;
+ else if (strcmp (argv[1], "1") == 0)
+ frozen = 1;
+ else
+ error (_("Invalid flag value"));
+
+ varobj_set_frozen (var, frozen);
+
+ /* We don't automatically return the new value, or what varobjs got new
+ values during unfreezing. If this information is required, client
+ should call -var-update explicitly. */
+ return MI_CMD_DONE;
+}
+
+
+enum mi_cmd_result
mi_cmd_var_show_format (char *command, char **argv, int argc)
{
enum varobj_display_formats format;
@@ -513,7 +546,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
cr = rootlist;
while (*cr != NULL)
{
- varobj_update_one (*cr, print_values);
+ varobj_update_one (*cr, print_values, 0 /* implicit */);
cr++;
}
do_cleanups (cleanup);
@@ -529,7 +562,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
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, print_values);
+ varobj_update_one (var, print_values, 1 /* explicit */);
do_cleanups (cleanup);
}
return MI_CMD_DONE;
@@ -538,14 +571,15 @@ mi_cmd_var_update (char *command, char **argv, int argc)
/* Helper for mi_cmd_var_update(). */
static void
-varobj_update_one (struct varobj *var, enum print_values print_values)
+varobj_update_one (struct varobj *var, enum print_values print_values,
+ int explicit)
{
struct varobj **changelist;
struct varobj **cc;
struct cleanup *cleanup = NULL;
int nc;
- nc = varobj_update (&var, &changelist);
+ nc = varobj_update (&var, &changelist, explicit);
/* nc >= 0 represents the number of changes reported into changelist.
nc < 0 means that an error occured or the the variable has
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index c891a77..683f1f1 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -156,6 +156,7 @@ struct mi_cmd mi_cmds[] =
{ "var-info-type", { NULL, 0 }, 0, mi_cmd_var_info_type},
{ "var-list-children", { NULL, 0 }, 0, mi_cmd_var_list_children},
{ "var-set-format", { NULL, 0 }, 0, mi_cmd_var_set_format},
+ { "var-set-frozen", { NULL, 0 }, 0, mi_cmd_var_set_frozen},
{ "var-show-attributes", { NULL, 0 }, 0, mi_cmd_var_show_attributes},
{ "var-show-format", { NULL, 0 }, 0, mi_cmd_var_show_format},
{ "var-update", { NULL, 0 }, 0, mi_cmd_var_update},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index e70b0f0..623181f 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -113,6 +113,7 @@ extern mi_cmd_argv_ftype mi_cmd_var_info_num_children;
extern mi_cmd_argv_ftype mi_cmd_var_info_type;
extern mi_cmd_argv_ftype mi_cmd_var_list_children;
extern mi_cmd_argv_ftype mi_cmd_var_set_format;
+extern mi_cmd_argv_ftype mi_cmd_var_set_frozen;
extern mi_cmd_argv_ftype mi_cmd_var_show_attributes;
extern mi_cmd_argv_ftype mi_cmd_var_show_format;
extern mi_cmd_argv_ftype mi_cmd_var_update;