Make varobj::children an std::vector
[deliverable/binutils-gdb.git] / gdb / varobj.h
index fc7f1770a75e9481162f280aa06065935711b806..ec8d62c2155196054cc63eb02497286aaf0843d7 100644 (file)
@@ -51,7 +51,7 @@ enum varobj_scope_status
   };
 
 /* String representations of gdb's format codes (defined in varobj.c).  */
-extern char *varobj_format_string[];
+extern const char *varobj_format_string[];
 
 /* Struct that describes a variable object instance.  */
 
@@ -89,6 +89,9 @@ struct varobj_dynamic;
    a particular object variable.  */
 struct varobj
 {
+  explicit varobj (varobj_root *root_);
+  ~varobj ();
+
   /* Name of the variable for this object.  If this variable is a
      child, then this name will be the child's source name.
      (bar, not foo.bar).  */
@@ -104,37 +107,37 @@ struct varobj
   std::string obj_name;
 
   /* Index of this variable in its parent or -1.  */
-  int index;
+  int index = -1;
 
   /* The type of this variable.  This can be NULL
      for artificial variable objects -- currently, the "accessibility"
      variable objects in C++.  */
-  struct type *type;
+  struct type *type = NULL;
 
   /* The value of this expression or subexpression.  A NULL value
      indicates there was an error getting this value.
      Invariant: if varobj_value_is_changeable_p (this) is non-zero, 
      the value is either NULL, or not lazy.  */
-  struct value *value;
+  struct value *value = NULL;
 
   /* The number of (immediate) children this variable has.  */
-  int num_children;
+  int num_children = -1;
 
   /* If this object is a child, this points to its immediate parent.  */
-  const struct varobj *parent;
+  struct varobj *parent = NULL;
 
   /* Children of this object.  */
-  VEC (varobj_p) *children;
+  std::vector<varobj *> children;
 
   /* Description of the root variable.  Points to root variable for
      children.  */
   struct varobj_root *root;
 
   /* The format of the output for this object.  */
-  enum varobj_display_formats format;
+  enum varobj_display_formats format = FORMAT_NATURAL;
 
   /* Was this variable updated via a varobj_set_value operation.  */
-  int updated;
+  int updated = 0;
 
   /* Last print value.  */
   std::string print_value;
@@ -142,18 +145,18 @@ struct varobj
   /* Is this variable frozen.  Frozen variables are never implicitly
      updated by -var-update * 
      or -var-update <direct-or-indirect-parent>.  */
-  int frozen;
+  int frozen = 0;
 
   /* Is the value of this variable intentionally not fetched?  It is
      not fetched if either the variable is frozen, or any parents is
      frozen.  */
-  int not_fetched;
+  int not_fetched = 0;
 
   /* Sub-range of children which the MI consumer has requested.  If
      FROM < 0 or TO < 0, means that all children have been
      requested.  */
-  int from;
-  int to;
+  int from = -1;
+  int to = -1;
 
   /* Dynamic part of varobj.  */
   struct varobj_dynamic *dynamic;
@@ -233,7 +236,7 @@ extern struct varobj *varobj_create (const char *objname,
                                     const char *expression, CORE_ADDR frame,
                                     enum varobj_type type);
 
-extern char *varobj_gen_name (void);
+extern std::string varobj_gen_name (void);
 
 extern struct varobj *varobj_get_handle (const char *name);
 
@@ -277,8 +280,8 @@ extern int varobj_get_num_children (struct varobj *var);
    that was returned.  The resulting VEC will contain at least the
    children from *FROM to just before *TO; it might contain more
    children, depending on whether any more were available.  */
-extern VEC (varobj_p)* varobj_list_children (struct varobj *var,
-                                            int *from, int *to);
+extern const std::vector<varobj *> &
+  varobj_list_children (struct varobj *var, int *from, int *to);
 
 extern std::string varobj_get_type (struct varobj *var);
 
@@ -320,8 +323,6 @@ extern int varobj_has_more (const struct varobj *var, int to);
 
 extern int varobj_is_dynamic_p (const struct varobj *var);
 
-extern struct cleanup *varobj_ensure_python_env (const struct varobj *var);
-
 extern int varobj_default_value_is_changeable_p (const struct varobj *var);
 extern int varobj_value_is_changeable_p (const struct varobj *var);
 
@@ -340,8 +341,8 @@ extern std::string
 extern void varobj_formatted_print_options (struct value_print_options *opts,
                                            enum varobj_display_formats format);
 
-extern void varobj_restrict_range (VEC (varobj_p) *children, int *from,
-                                  int *to);
+extern void varobj_restrict_range (const std::vector<varobj *> &children,
+                                  int *from, int *to);
 
 extern int varobj_default_is_path_expr_parent (const struct varobj *var);
 
This page took 0.033053 seconds and 4 git commands to generate.