Lines Matching refs:var

138   struct varobj *var;
152 struct varobj *var;
183 static void free_variable (struct varobj *var);
185 static struct cleanup *make_cleanup_free_variable (struct varobj *var);
187 static struct type *get_type (struct varobj *var);
189 static struct type *get_type_deref (struct varobj *var);
197 static void vpush (struct vstack **pstack, struct varobj *var);
207 static enum varobj_languages variable_language (struct varobj *var);
219 static struct type *type_of_child (struct varobj *var);
221 static int variable_editable (struct varobj *var);
223 static char *my_value_of_variable (struct varobj *var);
225 static int type_changeable (struct varobj *var);
229 static int c_number_of_children (struct varobj *var);
241 static int c_variable_editable (struct varobj *var);
243 static char *c_value_of_variable (struct varobj *var);
247 static int cplus_number_of_children (struct varobj *var);
261 static int cplus_variable_editable (struct varobj *var);
263 static char *cplus_value_of_variable (struct varobj *var);
267 static int java_number_of_children (struct varobj *var);
279 static int java_variable_editable (struct varobj *var);
281 static char *java_value_of_variable (struct varobj *var);
310 int (*variable_editable) (struct varobj * var);
313 char *(*value_of_variable) (struct varobj * var);
425 struct varobj *var;
432 var = new_root_variable ();
433 old_chain = make_cleanup_free_variable (var);
457 var->root->use_selected_frame = 1;
467 if (!gdb_parse_exp_1 (&p, block, 0, &var->root->exp))
473 if (var->root->exp->elts[0].opcode == OP_TYPE)
481 var->format = variable_default_display (var);
482 var->root->valid_block = innermost_block;
483 var->name = savestring (expression, strlen (expression));
491 var->root->frame = get_frame_id (fi);
499 if (gdb_evaluate_expression (var->root->exp, &var->value))
502 release_value (var->value);
503 if (VALUE_LAZY (var->value))
504 gdb_value_fetch_lazy (var->value);
507 var->value = evaluate_type (var->root->exp);
509 var->type = VALUE_TYPE (var->value);
512 lang = variable_language (var);
513 var->root->lang = languages[lang];
516 var->root->rootvar = var;
526 if ((var != NULL) && (objname != NULL))
528 var->obj_name = savestring (objname, strlen (objname));
532 if (!install_variable (var))
540 return var;
553 obj_name = xstrprintf ("var%d", id);
575 while ((cv != NULL) && (strcmp (cv->var->obj_name, objname) != 0))
581 return cv->var;
587 varobj_get_objname (struct varobj *var)
589 return var->obj_name;
595 varobj_get_expression (struct varobj *var)
597 return name_of_variable (var);
605 varobj_delete (struct varobj *var, char ***dellist, int only_children)
617 delcount = delete_variable (&result, var, 1 /* only the children */ );
620 delcount = delete_variable (&result, var, 0 /* parent+children */ );
648 varobj_set_display_format (struct varobj *var,
658 var->format = format;
662 var->format = variable_default_display (var);
665 return var->format;
669 varobj_get_display_format (struct varobj *var)
671 return var->format;
675 varobj_get_num_children (struct varobj *var)
677 if (var->num_children == -1)
678 var->num_children = number_of_children (var);
680 return var->num_children;
687 varobj_list_children (struct varobj *var, struct varobj ***childlist)
699 if (var->num_children == -1)
700 var->num_children = number_of_children (var);
703 *childlist = xmalloc ((var->num_children + 1) * sizeof (struct varobj *));
705 for (i = 0; i < var->num_children; i++)
711 name = name_of_child (var, i);
712 child = child_exists (var, name);
714 child = create_child (var, i, name);
722 return var->num_children;
729 varobj_get_type (struct varobj *var)
739 if (CPLUS_FAKE_CHILD (var))
747 val = value_zero (var->type, not_lval);
756 varobj_get_language (struct varobj *var)
758 return variable_language (var);
762 varobj_get_attributes (struct varobj *var)
766 if (variable_editable (var))
774 varobj_get_value (struct varobj *var)
776 return my_value_of_variable (var);
784 varobj_set_value (struct varobj *var, char *expression)
797 if (var->value != NULL && variable_editable (var) && !var->error)
813 if (!my_value_equal (var->value, value, &error))
814 var->updated = 1;
815 if (!gdb_value_assign (var->value, value, &val))
817 value_free (var->value);
819 var->value = val;
897 /* Not a root var */
936 /* error2 replaces var->error since this new value
1044 delete_variable (struct cpstack **resultp, struct varobj *var,
1049 delete_variable_1 (resultp, &delcount, var,
1061 struct varobj *var, int only_children_p,
1068 for (vc = var->children; vc != NULL; vc = next)
1084 if (var->obj_name != NULL)
1086 cppush (resultp, xstrdup (var->obj_name));
1095 if ((remove_from_parent_p) && (var->parent != NULL))
1097 remove_child_from_parent (var->parent, var);
1100 if (var->obj_name != NULL)
1101 uninstall_variable (var);
1104 free_variable (var);
1109 install_variable (struct varobj *var)
1117 for (chp = var->obj_name; *chp; chp++)
1123 while ((cv != NULL) && (strcmp (cv->var->obj_name, var->obj_name) != 0))
1132 newvl->var = var;
1136 if (var->root->rootvar == var)
1140 var->root->next = NULL;
1142 var->root->next = rootlist;
1143 rootlist = var->root;
1152 uninstall_variable (struct varobj *var)
1163 for (chp = var->obj_name; *chp; chp++)
1170 while ((cv != NULL) && (strcmp (cv->var->obj_name, var->obj_name) != 0))
1177 fprintf_unfiltered (gdb_stdlog, "Deleting %s\n", var->obj_name);
1183 var->obj_name);
1195 if (var->root->rootvar == var)
1198 if (rootlist == var->root)
1199 rootlist = var->root->next;
1204 while ((cr != NULL) && (cr->rootvar != var))
1213 var->obj_name);
1229 child_exists (struct varobj *var, char *name)
1233 for (vc = var->children; vc != NULL; vc = vc->next)
1322 struct varobj *var;
1324 var = (struct varobj *) xmalloc (sizeof (struct varobj));
1325 var->name = NULL;
1326 var->obj_name = NULL;
1327 var->index = -1;
1328 var->type = NULL;
1329 var->value = NULL;
1330 var->error = 0;
1331 var->num_children = -1;
1332 var->parent = NULL;
1333 var->children = NULL;
1334 var->format = 0;
1335 var->root = NULL;
1336 var->updated = 0;
1338 return var;
1345 struct varobj *var = new_variable ();
1346 var->root = (struct varobj_root *) xmalloc (sizeof (struct varobj_root));;
1347 var->root->lang = NULL;
1348 var->root->exp = NULL;
1349 var->root->valid_block = NULL;
1350 var->root->frame = null_frame_id;
1351 var->root->use_selected_frame = 0;
1352 var->root->rootvar = NULL;
1354 return var;
1359 free_variable (struct varobj *var)
1362 if (var->root->rootvar == var)
1364 free_current_contents ((char **) &var->root->exp);
1365 xfree (var->root);
1368 xfree (var->name);
1369 xfree (var->obj_name);
1370 xfree (var);
1374 do_free_variable_cleanup (void *var)
1376 free_variable (var);
1380 make_cleanup_free_variable (struct varobj *var)
1382 return make_cleanup (do_free_variable_cleanup, var);
1391 get_type (struct varobj *var)
1394 type = var->type;
1404 get_type_deref (struct varobj *var)
1408 type = get_type (var);
1438 variable_default_display (struct varobj *var)
1501 vpush (struct vstack **pstack, struct varobj *var)
1506 s->var = var;
1518 if ((*pstack)->var == NULL && (*pstack)->next == NULL)
1522 v = s->var;
1568 variable_language (struct varobj *var)
1572 switch (var->root->exp->language_defn->la_language)
1595 number_of_children (struct varobj *var)
1597 return (*var->root->lang->number_of_children) (var);;
1602 name_of_variable (struct varobj *var)
1604 return (*var->root->lang->name_of_variable) (var);
1609 name_of_child (struct varobj *var, int index)
1611 return (*var->root->lang->name_of_child) (var, index);
1627 struct varobj *var;
1632 var = *var_handle;
1637 if (var->root->rootvar != var)
1640 if (var->root->use_selected_frame)
1644 old_type = varobj_get_type (var);
1645 tmp_var = varobj_create (NULL, var->name, (CORE_ADDR) 0,
1662 savestring (var->obj_name, strlen (var->obj_name));
1663 varobj_delete (var, NULL, 0);
1671 var = *var_handle;
1680 return (*var->root->lang->value_of_root) (var_handle);
1706 type_of_child (struct varobj *var)
1709 /* If the child had no evaluation errors, var->value
1711 if (var->value != NULL)
1712 return VALUE_TYPE (var->value);
1715 return (*var->root->lang->type_of_child) (var->parent, var->index);
1721 variable_editable (struct varobj *var)
1723 return (*var->root->lang->variable_editable) (var);
1728 my_value_of_variable (struct varobj *var)
1730 return (*var->root->lang->value_of_variable) (var);
1737 type_changeable (struct varobj *var)
1742 if (CPLUS_FAKE_CHILD (var))
1745 type = get_type (var);
1764 c_number_of_children (struct varobj *var)
1770 type = get_type (var);
1880 struct varobj *var = *var_handle;
1885 if (var->root->rootvar != var)
1886 /* Not a root var */
1891 if (var->root->valid_block == NULL)
1896 fi = frame_find_by_id (var->root->frame);
1908 if (gdb_evaluate_expression (var->root->exp, &new_val))
1919 var->error = 1;
1921 var->error = 0;
1925 var->error = 1;
2042 c_variable_editable (struct varobj *var)
2044 switch (TYPE_CODE (get_type (var)))
2062 c_value_of_variable (struct varobj *var)
2067 switch (TYPE_CODE (get_type (var)))
2077 number = xstrprintf ("[%d]", var->num_children);
2084 if (var->value == NULL)
2098 if (VALUE_LAZY (var->value))
2099 gdb_value_fetch_lazy (var->value);
2100 val_print (VALUE_TYPE (var->value),
2101 VALUE_CONTENTS_RAW (var->value), 0,
2102 VALUE_ADDRESS (var->value), stb,
2103 format_code[(int) var->format], 1, 0, 0);
2117 cplus_number_of_children (struct varobj *var)
2125 if (!CPLUS_FAKE_CHILD (var))
2127 type = get_type_deref (var);
2146 /* FIXME: save children in var */
2153 type = get_type_deref (var->parent);
2156 if (strcmp (var->name, "public") == 0)
2158 else if (strcmp (var->name, "private") == 0)
2166 children = c_number_of_children (var);
2460 cplus_variable_editable (struct varobj *var)
2462 if (CPLUS_FAKE_CHILD (var))
2465 return c_variable_editable (var);
2469 cplus_value_of_variable (struct varobj *var)
2474 if (CPLUS_FAKE_CHILD (var))
2477 return c_value_of_variable (var);
2484 java_number_of_children (struct varobj *var)
2486 return cplus_number_of_children (var);
2547 java_variable_editable (struct varobj *var)
2549 return cplus_variable_editable (var);
2553 java_value_of_variable (struct varobj *var)
2555 return cplus_value_of_variable (var);