summaryrefslogtreecommitdiff
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
commitddf0ea085b626ddcbb14f88f495bcb677b7ab6e9 (patch)
tree23357c4c7097c35cc21f9baba5c13f3d3ed57cee /gdb/varobj.h
parent9e5b9d2b295d1771647a9e4bc942e398142ccf9b (diff)
downloadbinutils-gdb-ddf0ea085b626ddcbb14f88f495bcb677b7ab6e9.tar.gz
Make varobj::children an std::vector
This patch makes the children field of varobj an std::vector, and updates the fallout. One note is that varobj::parent must be made non-const. The reason is that when a child deletes itself, it modifies its writes NULL to its slot in its parent's children vector. With the VEC, the const didn't made the parent's children vector content const, only the pointer to it, but with std::vector, even the content is. gdb/ChangeLog: * varobj.h (struct varobj) <parent>: Remove const. <children>: Change type to std::vector. (varobj_list_children): Return std::vector const reference. (varobj_restrict_range): Change parameter type to std::vector const reference. * varobj.c (varobj_has_more): Adjust. (varobj_restrict_range): Change parameter type to std::vector const reference and adjust. (install_dynamic_child): Adjust. (update_dynamic_varobj_children): Adjust. (varobj_list_children): Return std::vector const reference and adjust. (varobj_add_child): Adjust. (update_type_if_necessary): Adjust. (varobj_update): Adjust. (delete_variable_1): Adjust. * ada-varobj.c (ada_value_has_mutated): Adjust. * mi/mi-cmd-var.c (mi_cmd_var_list_children): Adjust.
Diffstat (limited to 'gdb/varobj.h')
-rw-r--r--gdb/varobj.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/varobj.h b/gdb/varobj.h
index bdf748f5a02..ec8d62c2155 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -124,10 +124,10 @@ struct varobj
int num_children = -1;
/* If this object is a child, this points to its immediate parent. */
- const struct varobj *parent = NULL;
+ struct varobj *parent = NULL;
/* Children of this object. */
- VEC (varobj_p) *children = NULL;
+ std::vector<varobj *> children;
/* Description of the root variable. Points to root variable for
children. */
@@ -280,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);
@@ -341,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);