diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2017-11-22 15:08:06 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-11-22 15:08:06 -0500 |
commit | ddf0ea085b626ddcbb14f88f495bcb677b7ab6e9 (patch) | |
tree | 23357c4c7097c35cc21f9baba5c13f3d3ed57cee /gdb/ada-varobj.c | |
parent | 9e5b9d2b295d1771647a9e4bc942e398142ccf9b (diff) | |
download | gdb-ddf0ea085b626ddcbb14f88f495bcb677b7ab6e9.zip gdb-ddf0ea085b626ddcbb14f88f495bcb677b7ab6e9.tar.gz gdb-ddf0ea085b626ddcbb14f88f495bcb677b7ab6e9.tar.bz2 |
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/ada-varobj.c')
-rw-r--r-- | gdb/ada-varobj.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index 34d9c7b..8e38c16 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -959,7 +959,6 @@ static int ada_value_has_mutated (const struct varobj *var, struct value *new_val, struct type *new_type) { - int i; int from = -1; int to = -1; @@ -983,10 +982,10 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val, has mutated or not. So just assume it hasn't. */ varobj_restrict_range (var->children, &from, &to); - for (i = from; i < to; i++) + for (int i = from; i < to; i++) if (ada_varobj_get_name_of_child (new_val, new_type, var->name.c_str (), i) - != VEC_index (varobj_p, var->children, i)->name) + != var->children[i]->name) return 1; return 0; |