diff options
Diffstat (limited to 'gdb/c-varobj.c')
-rw-r--r-- | gdb/c-varobj.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index 543cd58..05b5bd7 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -647,16 +647,18 @@ cplus_class_num_children (struct type *type, int children[3]) vptr_fieldno = get_vptr_fieldno (type, &basetype); for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); i++) { + field &fld = type->field (i); + /* If we have a virtual table pointer, omit it. Even if virtual table pointers are not specifically marked in the debug info, they should be artificial. */ if ((type == basetype && i == vptr_fieldno) - || type->field (i).is_artificial ()) + || fld.is_artificial ()) continue; - if (TYPE_FIELD_PROTECTED (type, i)) + if (fld.is_protected ()) children[v_protected]++; - else if (TYPE_FIELD_PRIVATE (type, i)) + else if (fld.is_private ()) children[v_private]++; else children[v_public]++; @@ -669,23 +671,6 @@ cplus_name_of_variable (const struct varobj *parent) return c_name_of_variable (parent); } -/* Check if field INDEX of TYPE has the specified accessibility. - Return 0 if so and 1 otherwise. */ - -static int -match_accessibility (struct type *type, int index, enum accessibility acc) -{ - if (acc == accessibility::PRIVATE && TYPE_FIELD_PRIVATE (type, index)) - return 1; - else if (acc == accessibility::PROTECTED && TYPE_FIELD_PROTECTED (type, index)) - return 1; - else if (acc == accessibility::PUBLIC && !TYPE_FIELD_PRIVATE (type, index) - && !TYPE_FIELD_PROTECTED (type, index)) - return 1; - else - return 0; -} - static void cplus_describe_child (const struct varobj *parent, int index, std::string *cname, struct value **cvalue, struct type **ctype, @@ -751,9 +736,9 @@ cplus_describe_child (const struct varobj *parent, int index, if ((type == basetype && type_index == vptr_fieldno) || type->field (type_index).is_artificial ()) ; /* ignore vptr */ - else if (match_accessibility (type, type_index, acc)) - --index; - ++type_index; + else if (type->field (type_index).accessibility () == acc) + --index; + ++type_index; } --type_index; |