示例#1
0
        } // end _AddBaseClassNodesToList()

        private void _AddBaseClassPointerNodesToList(List <DbgTemplateNode> list, DbgPointerTypeInfo pti)
        {
            DbgNamedTypeInfo dnti = pti;
            int numStars          = 0;

            while (dnti is DbgPointerTypeInfo)
            {
                dnti = ((DbgPointerTypeInfo)dnti).PointeeType;
                numStars++;
            }

            if (!typeof(DbgUdtTypeInfo).IsAssignableFrom(dnti.GetType()))
            {
                return; // It doesn't point to a UDT.
            }
            string stars = new String('*', numStars);
            var    q     = new Queue <DbgUdtTypeInfo>();
            var    uti   = (DbgUdtTypeInfo)dnti;

            uti.VisitAllBaseClasses((bc) => list.Add(DbgTemplateNode.CrackTemplate(bc.TemplateNode.FullName + stars)));
        } // end _AddBaseClassPointerNodesToList()
示例#2
0
        } // end GetTypeNames()

        /// <summary>
        ///    Creates or gets a pointer type, pointing to the current type.
        /// </summary>
        /// <remarks>
        ///    This creates a synthetic pointer type (or retrieves a previously created
        ///    one) because it doesn't work well to query for a pointer type (the '*' is
        ///    interpreted as a wildcard, and the results do not include the desired
        ///    pointer types).
        /// </remarks>
        public DbgPointerTypeInfo GetPointerType()
        {
            _EnsureValid();
            uint pointerTypeId = DbgHelp.TryGetSynthPointerTypeIdByPointeeTypeId(Debugger.DebuggerInterface,
                                                                                 Module.BaseAddress,
                                                                                 TypeId);

            if (0 == pointerTypeId)
            {
                pointerTypeId = DbgHelp.AddSyntheticPointerTypeInfo(Debugger.DebuggerInterface,
                                                                    Module.BaseAddress,
                                                                    TypeId,
                                                                    Debugger.PointerSize,
                                                                    0);   // no predetermined typeId
            }
            var ptrType = new DbgPointerTypeInfo(Debugger,
                                                 Module,
                                                 pointerTypeId,
                                                 TypeId,
                                                 Debugger.PointerSize,
                                                 false);

            return(ptrType);
        }
示例#3
0
        public IReadOnlyList <DbgTemplateNode> GetTemplateNodes()
        {
            if (null == m_templateNodes)
            {
                var templateTypeNames = new List <DbgTemplateNode>();
                DbgArrayTypeInfo ati  = this as DbgArrayTypeInfo;
                if (null != ati)
                {
                    templateTypeNames.Add(DbgTemplateNode.CrackTemplate(ati.ArrayElementType.Name + "[]"));     // we don't want the dimensions
                    // TODO: And maybe for array types, we'd like to include the array type /with/ dimensions,
                    // so that, for instance, all Foo[8] could be treated specially or something. But maybe that's
                    // stretching it.

                    // TODO: How about co-(or is it contra-)variance? (should we get base types of the element type, like we do for pointers?)
                }
                else if (typeof(DbgUdtTypeInfo).IsAssignableFrom(GetType()))
                {
                    DbgUdtTypeInfo uti = (DbgUdtTypeInfo)this;
                    templateTypeNames.Add(uti.TemplateNode);
                    _AddBaseClassNodesToList(templateTypeNames, uti);
                }
                else if (typeof(DbgPointerTypeInfo).IsAssignableFrom(GetType()))
                {
                    DbgPointerTypeInfo pti = (DbgPointerTypeInfo)this;
                    templateTypeNames.Add(pti.TemplateNode);
                    _AddBaseClassPointerNodesToList(templateTypeNames, pti);
                }
                else
                {
                    templateTypeNames.Add(DbgTemplateNode.CrackTemplate(Name));
                }

                m_templateNodes = templateTypeNames.AsReadOnly();
            }
            return(m_templateNodes);
        } // end GetTemplateNodes()