aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2000-03-13 21:51:46 +0000
committerJim Ingham <jingham@apple.com>2000-03-13 21:51:46 +0000
commit73a93a3251211bf8c5774282e41dbc023820404a (patch)
treed1cedff69c4d1306c93cc4bfb59d4719026200b6 /gdb/mi
parent271bb601c426b043736a308b1a5f6d36bb47857a (diff)
downloadgdb-73a93a3251211bf8c5774282e41dbc023820404a.zip
gdb-73a93a3251211bf8c5774282e41dbc023820404a.tar.gz
gdb-73a93a3251211bf8c5774282e41dbc023820404a.tar.bz2
2000-03-13 James Ingham <jingham@leda.cygnus.com>
Add support for a variable object that tries to evaluate itself in the currently selected frame, rather than in a fixed frame. * wrapper.c,h (gdb_parse_exp_1): Added a wrapper for gdb_parse_exp_1. * varobj.h: Added USE_CURRENT_FRAME to varobj_type & changed def'n of varobj_create. * varobj.c (varobj_list): Return type indicates whether the variable's type has changed (for current frame variables). (varobj_update): Handle the case where the variable's type has changed. (delete_variable_1): Allow for deletion of variables that have not been installed yet. (new_root_variable): Initialize use_selected_frame variable. (value_of_root): This is where most of the work to handle "current frame" variables was added. Most of the complexity involves handling the case where the type of the variable has changed. (varobj_create): Add a "type" argument, to tell if the variable is one of these "current frame" variables. Also protect call to parse_exp_1 from long jumping. * mi-var-block.exp: The error report from varobj_create changed since I am now trapping parse_exp_1 errors. Change the tests to match the new error message. * mi-var-child.exp: Ditto. * mi-var-cmd.exp: Ditto. * lib/gdb.exp: Fix the gdbtk_start routine to correctly find all the library directories. * gdbtk-varobj.c (variable_create): Pass the correct "how_specified" flag to the varobj_create routine.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/ChangeLog-mi7
-rw-r--r--gdb/mi/mi-cmd-var.c65
2 files changed, 56 insertions, 16 deletions
diff --git a/gdb/mi/ChangeLog-mi b/gdb/mi/ChangeLog-mi
index 6abbfa2..eae7d38 100644
--- a/gdb/mi/ChangeLog-mi
+++ b/gdb/mi/ChangeLog-mi
@@ -1,3 +1,10 @@
+2000-03-13 James Ingham <jingham@leda.cygnus.com>
+
+ * mi-cmd-var.c (mi_cmd_var_create): Add special frame cookie "@"
+ to indicate an "USE_CURRENT_FRAME" variable.
+ (varobj_update_one): Add "in_scope" and "type_changed" to the
+ result.
+
2000-03-06 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* mi-cmds.h: Export mi_cmd_data_write_register_values.
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 568cb7e..a20f4f1 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -34,20 +34,21 @@
extern int varobjdebug; /* defined in varobj.c */
-static void varobj_update_one (struct varobj *var);
+static int varobj_update_one (struct varobj *var);
/* VAROBJ operations */
enum mi_cmd_result
mi_cmd_var_create (char *command, char **argv, int argc)
{
- CORE_ADDR frameaddr;
+ CORE_ADDR frameaddr = 0;
struct varobj *var;
char *name;
char *frame;
char *expr;
char *type;
struct cleanup *old_cleanups;
+ enum varobj_type var_type;
if (argc != 3)
{
@@ -77,16 +78,21 @@ mi_cmd_var_create (char *command, char **argv, int argc)
error ("mi_cmd_var_create: name of object must begin with a letter");
if (strcmp (frame, "*") == 0)
- frameaddr = -1;
+ var_type = USE_CURRENT_FRAME;
+ else if (strcmp (frame, "@") == 0)
+ var_type = USE_SELECTED_FRAME;
else
- frameaddr = parse_and_eval_address (frame);
+ {
+ var_type = USE_SPECIFIED_FRAME;
+ frameaddr = parse_and_eval_address (frame);
+ }
if (varobjdebug)
fprintf_unfiltered (gdb_stdlog,
"Name=\"%s\", Frame=\"%s\" (0x%s), Expression=\"%s\"\n",
name, frame, paddr (frameaddr), expr);
- var = varobj_create (name, expr, frameaddr);
+ var = varobj_create (name, expr, frameaddr, var_type);
if (var == NULL)
error ("mi_cmd_var_create: unable to create variable object");
@@ -443,12 +449,14 @@ mi_cmd_var_update (char *command, char **argv, int argc)
varobj_update_one (var);
ui_out_list_end (uiout);
}
- return MI_CMD_DONE;
+ return MI_CMD_DONE;
}
-/* Helper for mi_cmd_var_update() */
+/* 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. */
-static void
+static int
varobj_update_one (struct varobj *var)
{
struct varobj **changelist;
@@ -457,16 +465,41 @@ varobj_update_one (struct varobj *var)
nc = varobj_update (var, &changelist);
- if (nc <= 0)
- return;
-
- cc = changelist;
- while (*cc != NULL)
+ /* 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. */
+
+ if (nc == 0)
+ return 1;
+ else if (nc == -1)
{
- ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
- cc++;
+ ui_out_field_string (uiout, "name", varobj_get_objname(var));
+ ui_out_field_string (uiout, "in_scope", "false");
+ return -1;
+ }
+ else if (nc == -2)
+ {
+ 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));
+ }
+ else
+ {
+
+ cc = changelist;
+ while (*cc != 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");
+ cc++;
+ }
+ free (changelist);
+ return 1;
}
- free (changelist);
+ return 1;
}
/* Local variables: */