--- varobj.0.c Fri Oct 11 15:46:03 2002 +++ varobj.c Fri Oct 11 18:28:06 2002 @@ -2195,23 +2195,49 @@ if (CPLUS_FAKE_CHILD (parent)) { - int i; + int i = index; /* Skip over vptr, if it exists. */ if (TYPE_VPTR_BASETYPE (type) == type && index >= TYPE_VPTR_FIELDNO (type)) index++; - /* FIXME: This assumes that type orders - inherited, public, private, protected */ - i = index + TYPE_N_BASECLASSES (type); - if (STREQ (parent->name, "private") - || STREQ (parent->name, "protected")) - i += children[v_public]; - if (STREQ (parent->name, "protected")) - i += children[v_private]; + index = TYPE_N_BASECLASSES (type); + if (STREQ (parent->name, "private")) + { + while (i >= 0) + { + if (TYPE_FIELD_PRIVATE (type, index)) + --i; + ++index; + } + --index; + } + else if (STREQ (parent->name, "protected")) + { + while (i >= 0) + { + if (TYPE_FIELD_PROTECTED (type, index)) + --i; + ++index; + } + --index; + } + else if (STREQ (parent->name, "public")) + { + while (i >= 0) + { + if (!TYPE_FIELD_PRIVATE (type, index) && + !TYPE_FIELD_PROTECTED (type, index)) + --i; + ++index; + } + --index; + } + else + index += i; - name = TYPE_FIELD_NAME (type, i); + name = TYPE_FIELD_NAME (type, index); } else if (index < TYPE_N_BASECLASSES (type)) name = TYPE_FIELD_NAME (type, index);