Exemple #1
0
        private void _PopulateMembers()
        {
            Util.Assert(null == m_members);   // shouldn't need to do this more than once

            var members     = new NameIndexableList <DbgDataMemberTypeInfo>();
            var statics     = new NameIndexableList <DbgDataStaticMemberTypeInfo>();
            var bases       = new NameIndexableList <DbgBaseClassTypeInfo>();
            var virtBases   = new NameIndexableList <DbgVirtualBaseClassTypeInfo>();
            var nestedTypes = new NameIndexableList <DbgUdtTypeInfo>();
            var nestedEnums = new NameIndexableList <DbgEnumTypeInfo>();
            var typedefs    = new NameIndexableList <DbgTypedefTypeInfo>();
            var functions   = new NameIndexableList <DbgFunctionTypeInfo>();

            var childrenIds = GetChildrenIds(m_numChildren);   // _EnsureValid() called here
            var children    = new List <DbgTypeInfo>(childrenIds.Length);

            foreach (var childId in childrenIds)
            {
                var child = DbgTypeInfo.GetTypeInfo(Debugger, Module, childId);
                children.Add(child);

                if (child is DbgDataMemberTypeInfo)
                {
                    members.Add((DbgDataMemberTypeInfo)child);
                }
                else if (child is DbgDataStaticMemberTypeInfo)
                {
                    statics.Add((DbgDataStaticMemberTypeInfo)child);
                }
                else if (child is DbgBaseClassTypeInfo)
                {
                    DbgBaseClassTypeInfo bcti = (DbgBaseClassTypeInfo)child;
                    bases.Add(bcti);
                    bcti.AggregateMembers(members, statics);
                }
                else if (child is DbgVirtualBaseClassTypeInfo)
                {
                    virtBases.Add((DbgVirtualBaseClassTypeInfo)child);
                }
                else if (child is DbgUdtTypeInfo)
                {
                    nestedTypes.Add((DbgUdtTypeInfo)child);
                }
                else if (child is DbgEnumTypeInfo)
                {
                    nestedEnums.Add((DbgEnumTypeInfo)child);
                }
                else if (child is DbgTypedefTypeInfo)
                {
                    typedefs.Add((DbgTypedefTypeInfo)child);
                }
                else if (child is DbgFunctionTypeInfo)
                {
                    functions.Add((DbgFunctionTypeInfo)child);
                }
                else if (child is DbgVTableTypeInfo)
                {
                    m_vtable = (DbgVTableTypeInfo)child;
                }
                else
                {
#if DEBUG
                    string key = Util.Sprintf("{0}+{1}", Util.GetGenericTypeName(child), child.SymTag);
                    if (sm_unhandledTypes.Add(key))
                    {
                        LogManager.Trace("Need to handle children of type {0} ({1}, parent {2}, id {3}).", Util.GetGenericTypeName(child), child.SymTag, TypeId, child.TypeId);
                    }
#endif
                }
            }

            m_children = children.AsReadOnly();

            members.Freeze();
            statics.Freeze();
            bases.Freeze();
            virtBases.Freeze();
            nestedTypes.Freeze();
            nestedEnums.Freeze();
            typedefs.Freeze();
            functions.Freeze();

            m_members         = members;
            m_staticMembers   = statics;
            m_baseClasses     = bases;
            m_virtBaseClasses = virtBases;
            m_nestedTypes     = nestedTypes;
            m_nestedEnums     = nestedEnums;
            m_typedefs        = typedefs;
            m_functions       = functions;
        } // end _PopulateMembers()