private void CreateFreeType() { ulong free = NativeRuntime.GetFreeType(); IMethodTableData mtData = NativeRuntime.GetMethodTableData(free); _free = new NativeType(this, _types.Count, _mrtModule, "Free", free, mtData); _indices[free] = _types.Count; _types.Add(_free); }
private ClrType ConstructObjectType(ulong eeType) { IMethodTableData mtData = NativeRuntime.GetMethodTableData(eeType); if (mtData == null) { return(null); } ulong componentType = mtData.ElementTypeHandle; bool isArray = componentType != 0; // EEClass is the canonical method table. I stuffed the pointer there instead of creating a new property. ulong canonType = isArray ? componentType : mtData.EEClass; if (!isArray && canonType != 0) { int index; if (!isArray && _indices.TryGetValue(canonType, out index)) { _indices[eeType] = index; // Link the original eeType to its canonical GCHeapType. return(_types[index]); } ulong tmp = eeType; eeType = canonType; canonType = tmp; } NativeModule module = FindContainingModule(eeType); if (module == null && canonType != 0) { module = FindContainingModule(canonType); } string name = null; if (module != null) { Debug.Assert(module.ImageBase < eeType); PdbInfo pdb = module.Pdb; ISymbolResolver resolver; if (pdb != null) { if (!_resolvers.TryGetValue(module, out resolver)) { _resolvers[module] = resolver = _symProvider.GetSymbolResolver(pdb.FileName, pdb.Guid, pdb.Revision); } name = resolver == null ? null : resolver.GetSymbolNameByRVA((uint)(eeType - module.ImageBase)); } } if (name == null) { string moduleName = module != null?Path.GetFileNameWithoutExtension(module.FileName) : "UNKNWON"; name = string.Format("{0}_{1:x}", moduleName, eeType); } int len = name.Length; if (name.EndsWith("::`vftable'")) { len -= 11; } int i = name.IndexOf('!') + 1; name = name.Substring(i, len - i); if (isArray) { name += "[]"; } if (module == null) { module = _mrtModule; } NativeType type = new NativeType(this, _types.Count, module, name, eeType, mtData); _indices[eeType] = _types.Count; if (!isArray) { _indices[canonType] = _types.Count; } _types.Add(type); return(type); }
private ClrType ConstructObjectType(ulong eeType) { IMethodTableData mtData = NativeRuntime.GetMethodTableData(eeType); if (mtData == null) { return(null); } ulong componentType = mtData.ElementTypeHandle; bool isArray = componentType != 0; // EEClass is the canonical method table. I stuffed the pointer there instead of creating a new property. ulong canonType = isArray ? componentType : mtData.EEClass; if (!isArray && canonType != 0) { int index; if (!isArray && _indices.TryGetValue(canonType, out index)) { _indices[eeType] = index; // Link the original eeType to its canonical GCHeapType. return(_types[index]); } ulong tmp = eeType; eeType = canonType; canonType = tmp; } string name = NativeRuntime.ResolveSymbol(eeType); if (string.IsNullOrEmpty(name)) { name = NativeRuntime.ResolveSymbol(canonType); if (name == null) { name = string.Format("unknown type {0:x}", eeType); } } int len = name.Length; if (name.EndsWith("::`vftable'")) { len -= 11; } int i = name.IndexOf('!') + 1; name = name.Substring(i, len - i); if (isArray) { name += "[]"; } NativeModule module = FindContainingModule(eeType); if (module == null && canonType != 0) { module = FindContainingModule(canonType); } if (module == null) { module = _mrtModule; } NativeType type = new NativeType(this, _types.Count, module, name, eeType, mtData); _indices[eeType] = _types.Count; if (!isArray) { _indices[canonType] = _types.Count; } _types.Add(type); return(type); }