Example #1
0
        } // end GetChildrenIds()

        private static DbgTypeInfo _DefaultFactory(DbgEngDebugger debugger,
                                                   DbgModuleInfo module,
                                                   uint typeId,
                                                   SymTag symTag)
        {
            return(new DbgTypeInfo(debugger, module, typeId, symTag));
        }
Example #2
0
        } // end GetColorName()

        public static DbgFunctionTypeTypeInfo GetFunctionTypeTypeInfo(DbgEngDebugger debugger,
                                                                      DbgModuleInfo module,
                                                                      uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (null == module)
            {
                throw new ArgumentNullException("module");
            }

            var rfti = DbgHelp.GetFuncTypeInfo(debugger.DebuggerInterface,
                                               module.BaseAddress,
                                               typeId);

            return(new DbgFunctionTypeTypeInfo(debugger,
                                               module,
                                               typeId,
                                               rfti.ReturnTypeId,
                                               rfti.ClassParentId,
                                               rfti.ThisAdjust,
                                               rfti.CallingConvention,
                                               rfti.Arguments));
        } // end GetUdtTypeInfo()
Example #3
0
        } // end property IsAbstract


        public static DbgFunctionTypeInfo GetFunctionTypeInfo(DbgEngDebugger debugger,
                                                              DbgModuleInfo module,
                                                              uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (null == module)
            {
                throw new ArgumentNullException("module");
            }

            RawFuncInfo rfi = DbgHelp.GetFuncInfo(debugger.DebuggerInterface, module.BaseAddress, typeId);

            return(new DbgFunctionTypeInfo(debugger,
                                           module,
                                           typeId,
                                           rfi.FuncName,
                                           rfi.FunctionTypeTypeId,
                                           rfi.OwningClassTypeId,
                                           rfi.ChildrenCount,
                                           rfi.Address,
                                           rfi.Length,
                                           rfi.VirtualBaseOffset,
                                           rfi.SymIndex));
        } // end GetFunctionTypeInfo()
Example #4
0
        private static DbgTypeInfo _LoadTypeInfo(DbgEngDebugger debugger,
                                                 DbgModuleInfo module,
                                                 uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (IsDbgGeneratedType(typeId) &&
                !DbgHelp.PeekSyntheticTypeExists(debugger.DebuggerInterface,
                                                 module.BaseAddress,
                                                 typeId))
            {
                return(new DbgGeneratedTypeInfo(debugger, module, typeId));
            }

            return(debugger.ExecuteOnDbgEngThread(() =>
            {
                var symTag = DbgHelp.GetSymTag(debugger.DebuggerInterface,
                                               module.BaseAddress,
                                               typeId);
                return _LoadTypeInfo(debugger, module, typeId, symTag);
            }));
        }
Example #5
0
        } // end constructor

        protected DbgBaseClassTypeInfoBase(DbgEngDebugger debugger,
                                           DbgModuleInfo module,
                                           uint typeId,
                                           UdtKind kind,
                                           string name,
                                           ulong size,
                                           uint numChildren,
                                           uint classParentId,    // could be 0?
                                           uint vtableShapeId,    // could be 0?
                                           bool isVirtBaseClass,
                                           bool isIndirectVirtBaseClass,
                                           uint baseClassTypeId)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   kind,
                   name,
                   size,
                   numChildren,
                   classParentId,
                   vtableShapeId,
                   isVirtBaseClass,
                   isIndirectVirtBaseClass,
                   baseClassTypeId,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #6
0
 public static DbgNamedTypeInfo GetNamedTypeInfo(DbgEngDebugger debugger,
                                                 DbgModuleInfo module,
                                                 uint typeId,
                                                 SymTag symTag)
 {
     return(_EnsureIsNamed(GetTypeInfo(debugger, module, typeId, symTag)));
 }
        } // end constructor

        public DbgVirtualBaseClassTypeInfo(DbgEngDebugger debugger,
                                           DbgModuleInfo module,
                                           uint typeId,
                                           UdtKind kind,
                                           string name,
                                           ulong size,
                                           uint numChildren,
                                           uint classParentId,    // could be 0?
                                           uint vtableShapeId,    // could be 0?
                                           bool isVirtBaseClass,
                                           bool isIndirectVirtBaseClass,
                                           uint baseClassTypeId,
                                           uint virtualBaseDispIndex,
                                           uint virtualBasePointerOffset)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   kind,
                   name,
                   size,
                   numChildren,
                   classParentId,
                   vtableShapeId,
                   isVirtBaseClass,
                   isIndirectVirtBaseClass,
                   baseClassTypeId,
                   virtualBaseDispIndex,
                   virtualBasePointerOffset,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #8
0
        public static DbgUdtTypeInfo GetUdtTypeInfo(DbgEngDebugger debugger,
                                                    DbgModuleInfo module,
                                                    uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (null == module)
            {
                throw new ArgumentNullException("module");
            }

            RawUdtInfo rui = DbgHelp.GetUdtInfo(debugger.DebuggerInterface, module.BaseAddress, typeId);

            return(new DbgUdtTypeInfo(debugger,
                                      module,
                                      typeId,
                                      rui.UdtKind,
                                      rui.SymName,
                                      rui.Size,
                                      rui.ChildrenCount,
                                      rui.ClassParentId,
                                      rui.VirtualTableShapeId));
        } // end GetUdtTypeInfo()
Example #9
0
        } // end constructor

        public DbgFunctionTypeInfo(DbgEngDebugger debugger,
                                   DbgModuleInfo module,
                                   uint typeId,
                                   string name,
                                   uint functionTypeTypeId,
                                   uint owningClassTypeId,
                                   uint numChildren,
                                   ulong address,
                                   ulong length,
                                   uint virtualBaseOffset,
                                   uint symIndex)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   name,
                   functionTypeTypeId,
                   owningClassTypeId,
                   numChildren,
                   address,
                   length,
                   virtualBaseOffset,
                   symIndex,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #10
0
        } // end _SummarizeModuleList()

        // N.B. Assumes that the current context is correct.
        internal void AddModule(DbgModuleInfo modInfo)
        {
            if (null == m_modules)
            {
                Debugger.GetModuleInfo(out m_modules, out m_unloadedModules);
            }
            else
            {
                if (modInfo.IsUnloaded)
                {
                    // TODO BUGBUG: uh... probably need to remove it from the loaded list?
                    // Except... sometimes modules are on both the loaded and unloaded
                    // list (and sometimes on the unloaded list more than once), so when
                    // do I remove it? Crud; I probably have to re-query instead of just
                    // relying on incremental changes via notifications.
                    m_unloadedModules.Add(modInfo);
                }
                else
                {
#if DEBUG
                    Util.Assert(!m_modules.Contains(modInfo));
#endif
                    m_modules.Add(modInfo);
                }
            }
        } // end AddModule()
Example #11
0
        private static DbgTypeInfo _LoadTypeInfo(DbgEngDebugger debugger,
                                                 DbgModuleInfo module,
                                                 uint typeId,
                                                 SymTag symTag)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (IsDbgGeneratedType(typeId) &&
                !DbgHelp.PeekSyntheticTypeExists(debugger.DebuggerInterface,
                                                 module.BaseAddress,
                                                 typeId))
            {
                return(new DbgGeneratedTypeInfo(debugger, module, typeId, symTag));
            }

            return(debugger.ExecuteOnDbgEngThread(() =>
            {
                if (((int)symTag) > sm_factories.Length)
                {
                    // In case they extend the SymTag enum and I don't get updated.
                    Util.Fail("Need to update SymTag enum.");
                    return _DefaultFactory(debugger, module, typeId, symTag);
                }

                return sm_factories[(int)symTag](debugger, module, typeId);
            }));
        } // end _LoadTypeInfo()
Example #12
0
        } // end constructor

        protected static ulong GetModBase(DbgModuleInfo module)
        {
            if (null == module)
            {
                throw new ArgumentNullException("module");
            }
            return(module.BaseAddress);
        }
Example #13
0
        } // end constructor

        public DbgFunctionArgTypeTypeInfo(DbgEngDebugger debugger,
                                          DbgModuleInfo module,
                                          uint typeId,
                                          uint argTypeId)
            : this(debugger, GetModBase(module), typeId, argTypeId, module.Target)
        {
            __mod = module;
        } // end constructor
Example #14
0
 protected DbgTypeInfo(DbgEngDebugger debugger,
                       DbgModuleInfo module,
                       uint typeId,
                       SymTag symTag)
     : this(debugger, GetModBase(module), typeId, symTag, module.Target)
 {
     __mod = module;
 } // end constructor
        } // end constructor

        protected DbgDataMemberTypeInfoBase(DbgEngDebugger debugger,
                                            DbgModuleInfo module,
                                            uint typeId,
                                            string name,
                                            DataKind kind,
                                            uint memberTypeId,
                                            uint owningTypeId)
            : base(debugger, module, typeId, name, kind, memberTypeId)
        {
            m_owningTypeId = owningTypeId;
        } // end constructor
Example #16
0
        } // end ModuleUnloaded

        // N.B. Assumes that the current context is correct.
        internal void RefreshModuleAt(ulong baseAddress)
        {
            if (null != m_modules)
            {
                DbgModuleInfo mod = m_modules.FirstOrDefault((m) => m.BaseAddress == baseAddress);
                if (null != mod)
                {
                    mod.Refresh();
                }
            }
        } // end RefreshModuleAt()
        } // end constructor

        public DbgVTableShapeTypeInfo(DbgEngDebugger debugger,
                                      DbgModuleInfo module,
                                      uint typeId,
                                      uint numSlots)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   numSlots,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #18
0
        } // end constructor

        protected DbgDataTypeInfo(DbgEngDebugger debugger,
                                  DbgModuleInfo module,
                                  uint typeId,
                                  RawDataInfo rdi)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   rdi,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #19
0
        public static DbgTypeInfo GetTypeInfo(DbgEngDebugger debugger,
                                              DbgModuleInfo module,
                                              uint typeId)
        {
            DbgTypeInfo typeInfo;

            if (!_TryGetFromCache(module.BaseAddress, typeId, module.Target, out typeInfo))
            {
                typeInfo = _LoadTypeInfo(debugger, module, typeId);
                _AddToCache(typeInfo);
            }
            return(typeInfo);
        }
Example #20
0
        } // end constructor

        public static DbgBaseTypeInfo GetBaseTypeInfo(DbgEngDebugger debugger,
                                                      DbgModuleInfo module,
                                                      uint typeId)
        {
            BasicType baseType;
            ulong     size;

            DbgHelp.GetBaseTypeInfo(debugger.DebuggerInterface,
                                    module.BaseAddress,
                                    typeId,
                                    out baseType,
                                    out size);
            return(new DbgBaseTypeInfo(debugger, module, typeId, baseType, size));
        }
Example #21
0
        } // end constructor

        public DbgBaseTypeInfo(DbgEngDebugger debugger,
                               DbgModuleInfo module,
                               uint typeId,
                               BasicType baseType,
                               ulong size)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   baseType,
                   size,
                   module.Target)
        {
            __mod = module;
        } // end constructor
        public static DbgNullTypeInfo GetNullTypeInfo(DbgEngDebugger debugger,
                                                      DbgModuleInfo module,
                                                      uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            // This does not need to be an invariant; I'm just curious if it's ever not 0.
            Util.Assert(0 == typeId);

            return(new DbgNullTypeInfo(debugger, module, typeId));
        } // end GetNullTypeInfo()
Example #23
0
        } // end constructor

        public DbgTypedefTypeInfo(DbgEngDebugger debugger,
                                  DbgModuleInfo module,
                                  uint typeId,
                                  uint representedTypeId,
                                  string typedefName)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   representedTypeId,
                   typedefName,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #24
0
        public static DbgBaseClassTypeInfoBase GetBaseClassTypeInfo(DbgEngDebugger debugger,
                                                                    DbgModuleInfo module,
                                                                    uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (null == module)
            {
                throw new ArgumentNullException("module");
            }

            RawBaseClassInfo rbci = DbgHelp.GetBaseClassInfo(debugger.DebuggerInterface, module.BaseAddress, typeId);

            if (rbci.IsVirtualBaseClass)
            {
                return(new DbgVirtualBaseClassTypeInfo(debugger,
                                                       module,
                                                       typeId,
                                                       rbci.UdtKind,
                                                       rbci.BaseClassTypeName,
                                                       rbci.BaseClassSize,
                                                       rbci.ChildrenCount,
                                                       rbci.ClassParentId,
                                                       rbci.VirtualTableShapeId,
                                                       rbci.IsVirtualBaseClass,
                                                       rbci.IsIndirectVirtualBaseClass,
                                                       rbci.BaseClassTypeId,
                                                       rbci.VirtualBaseDispIndex,
                                                       rbci.VirtualBasePointerOffset));
            }
            else
            {
                return(new DbgBaseClassTypeInfo(debugger,
                                                module,
                                                typeId,
                                                rbci.UdtKind,
                                                rbci.BaseClassTypeName,
                                                rbci.BaseClassSize,
                                                rbci.ChildrenCount,
                                                rbci.ClassParentId,
                                                rbci.VirtualTableShapeId,
                                                rbci.IsVirtualBaseClass,
                                                rbci.IsIndirectVirtualBaseClass,
                                                rbci.BaseClassTypeId,
                                                rbci.Offset));
            }
        } // end GetBaseClassTypeInfo()
        public static DbgEnumTypeInfo GetEnumTypeInfo(DbgEngDebugger debugger,
                                                      DbgModuleInfo module,
                                                      uint typeId)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            RawEnumInfo rei = DbgHelp.GetEnumInfo(debugger.DebuggerInterface,
                                                  module.BaseAddress,
                                                  typeId);

            return(new DbgEnumTypeInfo(debugger, module, rei));
        } // end GetEnumTypeInfo()
Example #26
0
        } // end constructor

        protected DbgNamedTypeInfo(DbgEngDebugger debugger,
                                   DbgModuleInfo module,
                                   uint typeId,
                                   SymTag symTag,
                                   ulong size)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   symTag,
                   null,
                   size,
                   module.Target)
        {
            __mod = module;
        } // end constructor
        public static DbgPointerTypeInfo GetPointerTypeInfo(DbgEngDebugger debugger,
                                                            DbgModuleInfo module,
                                                            uint typeId)
        {
            uint  pointeeTypeId;
            ulong size;
            bool  isReference;

            DbgHelp.GetPointerTypeInfo(debugger.DebuggerInterface,
                                       module.BaseAddress,
                                       typeId,
                                       out pointeeTypeId,
                                       out size,
                                       out isReference);
            return(new DbgPointerTypeInfo(debugger, module, typeId, pointeeTypeId, size, isReference));
        } // end GetPointerTypeInfo()
        } // end constructor

        public DbgPointerTypeInfo(DbgEngDebugger debugger,
                                  DbgModuleInfo module,
                                  uint typeId,
                                  uint pointeeTypeId,
                                  ulong size,
                                  bool isReference)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   pointeeTypeId,
                   size,
                   isReference,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #29
0
        } // end constructor

        public DbgArrayTypeInfo(DbgEngDebugger debugger,
                                DbgModuleInfo module,
                                uint typeId,
                                uint arrayTypeId,
                                uint count,
                                ulong size)
            : this(debugger,
                   GetModBase(module),
                   typeId,
                   arrayTypeId,
                   count,
                   size,
                   module.Target)
        {
            __mod = module;
        } // end constructor
Example #30
0
        } // end constructor

        protected DbgDataTypeInfo(DbgEngDebugger debugger,
                                  DbgModuleInfo module,
                                  uint typeId,
                                  string name,
                                  DataKind kind,
                                  uint memberTypeId)
            : base(debugger,
                   GetModBase(module),
                   typeId,
                   SymTag.Data,
                   name,
                   module.Target)
        {
            DataKind       = kind;
            m_memberTypeId = memberTypeId;
            __mod          = module;
        } // end constructor