} // end constructor

        private DbgEnumTypeInfo(DbgEnumTypeInfo copyMe,
                                ulong newSize)
            : this(copyMe.Debugger,
                   copyMe.Module.BaseAddress,
                   copyMe.TypeId,
                   copyMe.Name,
                   copyMe.BaseType.AsDifferentSize(newSize),
                   copyMe.m_numEnumerands,
                   copyMe.Target)
        {
            __mod = copyMe.Module;
        } // end constructor
Exemple #2
0
        internal override object GetConstantValue()
        {
            if (!IsConstant)
            {
                return(base.GetConstantValue()); // will throw
            }
            object rawVal = DbgHelp.SymGetTypeInfo(Debugger.DebuggerInterface,
                                                   Module.BaseAddress,
                                                   m_symInfo.Index,
                                                   IMAGEHLP_SYMBOL_TYPE_INFO.TI_GET_VALUE);

            // The raw value might be stored more efficiently than the actual type--for
            // instance, a DWORD constant might be stored (and returned from
            // SymGetTypeInfo) as a USHORT. So we might need to extend the value to get
            // fidelity with the true type of the constant.

            Debug.Assert((Type is DbgBaseTypeInfo) || (Type is DbgEnumTypeInfo));

            DbgBaseTypeInfo bti;

            bti = Type as DbgBaseTypeInfo;
            if (null == bti)
            {
                DbgEnumTypeInfo eti = Type as DbgEnumTypeInfo;
                if (null != eti)
                {
                    bti = eti.BaseType;
                }
                else
                {
                    throw new DbgProviderException(
                              Util.Sprintf("I don't know how to handle constants with Type: {0}",
                                           Util.GetGenericTypeName(Type)),
                              "DontKnowHowToHandleConstantType",
                              System.Management.Automation.ErrorCategory.NotImplemented);
                }
            }
            return(DbgHelp.ReconstituteConstant(rawVal, bti));
        }