aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-11-22 15:08:06 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-11-22 15:08:06 -0500
commit0604393c22f626f26b5a4a30e57da40404f5aa5e (patch)
tree9c0975d7db4c7d18f7a5a23816ac31b683e7dfb2 /gdb/varobj.h
parentddf0ea085b626ddcbb14f88f495bcb677b7ab6e9 (diff)
downloadgdb-0604393c22f626f26b5a4a30e57da40404f5aa5e.zip
gdb-0604393c22f626f26b5a4a30e57da40404f5aa5e.tar.gz
gdb-0604393c22f626f26b5a4a30e57da40404f5aa5e.tar.bz2
Replace VEC (varobj_update_result) with std::vector
This patch replaces makes varobj_update return an std::vector, and updates the fallouts. To make that easier, the varobj_update_result is c++ified a bit. I added a constructor and initialized its fields in-class. The newobj vector is also made an std::vector, so that it's automatically freed when varobj_update_result is destroyed and handled correctly by the default move constructor. I disabled copy constructor and assignment for that structure, because normally it never needs to be copied, only moved. As a result, the newobj parameter of update_dynamic_varobj_children must be changed to an std::vector. The patch converts the other vector parameters of update_dynamic_varobj_children to std::vector. It's not strictly necessary to do it in the same patch, but I think it makes sense to do it. gdb/ChangeLog: * varobj.h (struct varobj_update_result): Add constructor, add move constructor, disable copy and assign, initialize fields. <newobj>: Change type to std::vector. (varobj_update): Return std::vector. * varobj.c (install_dynamic_child): Change VEC parameters to std::vector and adjust. (update_dynamic_varobj_children): Likewise. (varobj_update): Return std::vector and adjust. * mi/mi-cmd-var.c (varobj_update_one): Adjust to vector changes.
Diffstat (limited to 'gdb/varobj.h')
-rw-r--r--gdb/varobj.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/gdb/varobj.h b/gdb/varobj.h
index ec8d62c..f8738f5 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -60,26 +60,33 @@ 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;
@@ -305,8 +312,8 @@ extern int varobj_set_value (struct varobj *var, const char *expression);
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);