struct varobj;
-typedef struct varobj *varobj_p;
-DEF_VEC_P (varobj_p);
-
-typedef struct varobj_update_result_t
+struct varobj_update_result
{
+ varobj_update_result (struct varobj *varobj_,
+ varobj_scope_status status_ = VAROBJ_IN_SCOPE)
+ : varobj (varobj_), status (status_)
+ {}
+
+ varobj_update_result (varobj_update_result &&other) = default;
+
+ DISABLE_COPY_AND_ASSIGN (varobj_update_result);
+
struct varobj *varobj;
- int type_changed;
- int children_changed;
- int changed;
+ int type_changed = 0;
+ int children_changed = 0;
+ int changed = 0;
enum varobj_scope_status status;
/* This variable is used internally by varobj_update to indicate if the
new value of varobj is already computed and installed, or has to
be yet installed. Don't use this outside varobj.c. */
- int value_installed;
+ int value_installed = 0;
/* This will be non-NULL when new children were added to the varobj.
It lists the new children (which must necessarily come at the end
of the child list) added during an update. The caller is
responsible for freeing this vector. */
- VEC (varobj_p) *newobj;
-} varobj_update_result;
-
-DEF_VEC_O (varobj_update_result);
+ std::vector<struct varobj *> newobj;
+};
struct varobj_root;
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). */
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;
/* 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;
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);
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);
extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
void *data);
-extern VEC(varobj_update_result) *varobj_update (struct varobj **varp,
- int is_explicit);
+extern std::vector<varobj_update_result>
+ varobj_update (struct varobj **varp, int is_explicit);
extern void varobj_invalidate (void);
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);