internal static IDebugType DebugTypeFromField(IDebugField field, IDebugContext context) { IDebugType type = null; FIELD_KIND kind; field.GetKind(out kind); if (0 != (FIELD_KIND.FIELD_KIND_TYPE & kind)) { if (0 != (kind & FIELD_KIND.FIELD_TYPE_PRIMITIVE)){ type = new CDebugPrimitiveType(field, context); } else if (0 != (kind & (FIELD_KIND.FIELD_TYPE_CLASS|FIELD_KIND.FIELD_TYPE_STRUCT|FIELD_KIND.FIELD_TYPE_INNERCLASS))) { IDebugClassField classField = null; if (null != (classField = field as IDebugClassField)) { if (classField.DoesInterfaceExist("StructuralTypes.TupleType") == (int)HResult.S_OK) type = new CDebugStructuralType(classField, context, StructTypes.Tuple); else if(classField.DoesInterfaceExist("StructuralTypes.TypeUnion") == (int)HResult.S_OK) type = new CDebugStructuralType(classField, context, StructTypes.Union); else if(classField.DoesInterfaceExist("StructuralTypes.TypeIntersection") == (int)HResult.S_OK) type = new CDebugStructuralType(classField, context, StructTypes.Intersection); else{ FIELD_INFO name = new FIELD_INFO(); classField.GetInfo(FIELD_INFO_FIELDS.FIF_NAME, out name); if (name.bstrName.IndexOf("IEnumerableOf") >=0) type = new CDebugStreamType(classField, context, StreamType.GenericIEnumerable); else if (name.bstrName.IndexOf("NonEmptyIEnumerableOf") >=0) type = new CDebugStreamType(classField, context, StreamType.GenericNonEmptyIEnumerable); else if (name.bstrName.IndexOf("NonNullOf") >=0) type = new CDebugStreamType(classField, context, StreamType.GenericNonNull); else if (name.bstrName.IndexOf("BoxedOf") >=0) type = new CDebugStreamType(classField, context, StreamType.GenericBoxed); else if (name.bstrName.IndexOf("IListOf") >=0) type = new CDebugFlexArrayType(classField, context); else type = new CDebugClassType(classField, context); } } } else if (0 != (kind & FIELD_KIND.FIELD_TYPE_ENUM)) { IDebugEnumField enumField = null; if (null != (enumField = field as IDebugEnumField)) { type = new CDebugEnumType(enumField, context); } } else if (0 != (kind & FIELD_KIND.FIELD_TYPE_ARRAY)) { IDebugArrayField arrayField = null; if (null != (arrayField = field as IDebugArrayField)) { type = new CDebugArrayType(arrayField, context); } } } return type; }
public IDebugType GetType(string fullName) { IDebugField type = null; this.SymbolProvider.GetTypeByName(fullName, NAME_MATCH.nmCaseSensitive, out type); if (type != null) return SymbolHelper.DebugTypeFromField(type, this); IEnumDebugFields namespaceList = null; this.SymbolProvider.GetNamespacesUsedAtAddress(this.Address, out namespaceList); if (namespaceList!= null){ int namespaceCount = 0; int fetched = 0; FIELD_INFO namespaceInfo = new FIELD_INFO(); namespaceList.GetCount(out namespaceCount); for (int i = 0; i < namespaceCount; i++){ IDebugField[] namespc = new IDebugField[1]; namespaceList.Next(1, namespc, out fetched); if (fetched > 0){ namespc[0].GetInfo(FIELD_INFO_FIELDS.FIF_FULLNAME, out namespaceInfo); this.SymbolProvider.GetTypeByName(namespaceInfo.bstrFullName+"."+fullName, NAME_MATCH.nmCaseSensitive, out type); if (type != null) return SymbolHelper.DebugTypeFromField(type, this); } } } if (type == null) this.SymbolProvider.GetTypeByName("StructuralTypes."+fullName, NAME_MATCH.nmCaseSensitive, out type); if (type != null) return SymbolHelper.DebugTypeFromField(type, this); return null; }
public IDebugClassType GetDeclaringType(){ FIELD_INFO info = new FIELD_INFO(); this.m_MethodField.GetInfo(FIELD_INFO_FIELDS.FIF_MODIFIERS, out info); if ((info.dwModifiers|FIELD_MODIFIERS.FIELD_MOD_STATIC) != 0){ IDebugContainerField containerField = null; IDebugClassField classField = null; this.m_MethodField.GetContainer(out containerField); classField = containerField as IDebugClassField; if (classField != null){ return new CDebugClassType(classField, this.m_Context); } } return null; }