internal DesktopRCWData(DesktopGCHeap heap, ulong rcw, IRCWData data) { _addr = rcw; _rcw = data; _heap = heap; _osThreadID = uint.MaxValue; }
internal DesktopRCWData(DesktopGCHeap heap, Address rcw, IRCWData data) { m_addr = rcw; m_rcw = data; m_heap = heap; m_osThreadID = uint.MaxValue; }
internal ulong GetMTForDomain(ClrAppDomain domain, DesktopHeapType type) { DesktopGCHeap heap = null; IList <MethodTableTokenPair> mtList = _runtime.GetMethodTableList(_mapping[domain]); bool hasToken = type.MetadataToken != 0 && type.MetadataToken != uint.MaxValue; uint token = ~0xff000000 & type.MetadataToken; foreach (MethodTableTokenPair pair in mtList) { if (hasToken) { if (pair.Token == token) { return(pair.MethodTable); } } else { if (heap == null) { heap = (DesktopGCHeap)_runtime.Heap; } if (heap.GetTypeByMethodTable(pair.MethodTable, 0) == type) { return(pair.MethodTable); } } } return(0); }
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name) { _field = field; _name = name; _token = field.FieldToken; _type = (BaseDesktopHeapType)heap.GetTypeByMethodTable(field.TypeMethodTable, 0); }
public BaseDesktopHeapType(ulong mt, DesktopGCHeap heap, DesktopBaseModule module, uint token) { _constructedMT = mt; DesktopHeap = heap; DesktopModule = module; _token = token; _gcDesc = new Lazy <GCDesc>(FillGCDesc); }
public DesktopPointerType(DesktopGCHeap heap, DesktopBaseModule module, ClrElementType eltype, uint token, string nameHint) : base(0, heap, module, token) { ElementType = ClrElementType.Pointer; _pointerElement = eltype; if (nameHint != null) { BuildName(nameHint); } }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { _name = name; _field = data; _attributes = attributes; _token = data.FieldToken; _heap = heap; _type = new Lazy <BaseDesktopHeapType>(() => GetType(_heap, data, sig, sigLen, (ClrElementType)_field.CorElementType)); }
public DesktopArrayType(DesktopGCHeap heap, DesktopBaseModule module, ClrElementType eltype, int ranks, uint token, string nameHint) : base(0, heap, module, token) { ElementType = ClrElementType.Array; _arrayElement = eltype; _ranks = ranks; if (nameHint != null) { BuildName(nameHint); } }
public override ClrHeap GetHeap() { if (_heap == null) { if (HasArrayComponentMethodTables) { _heap = new LegacyGCHeap(this); } else { _heap = new V46GCHeap(this); } } return(_heap); }
/// <summary> /// Flushes the dac cache. This function MUST be called any time you expect to call the same function /// but expect different results. For example, after walking the heap, you need to call Flush before /// attempting to walk the heap again. /// </summary> public override void Flush() { OnRuntimeFlushed(); Revision++; _dacInterface.Flush(); _modules.Clear(); _moduleFiles = null; _moduleSizes = null; _domains = null; _system = null; _shared = null; _threads = null; MemoryReader = null; _heap = null; _threadpool = null; }
public override IEnumerable <ClrType> EnumerateTypes() { DesktopGCHeap heap = (DesktopGCHeap)_runtime.Heap; IList <MethodTableTokenPair> mtList = _runtime.GetMethodTableList(_address); if (_typesLoaded) { foreach (ClrType type in heap.EnumerateTypes()) { if (type.Module == this) { yield return(type); } } } else { if (mtList != null) { foreach (MethodTableTokenPair pair in mtList) { ulong mt = pair.MethodTable; if (mt != _runtime.ArrayMethodTable) { // prefetch element type, as this also can load types ClrType type = heap.GetTypeByMethodTable(mt, 0, 0); if (type != null) { yield return(type); } } } } _typesLoaded = true; } }
internal DesktopCCWData(DesktopGCHeap heap, Address ccw, ICCWData data) { m_addr = ccw; m_ccw = data; m_heap = heap; }
/// <summary> /// Gets the GC heap of the process. /// </summary> public override ClrHeap GetHeap(TextWriter diagnosticLog) { if (_heap == null) _heap = new DesktopGCHeap(this, diagnosticLog); return _heap; }
public override ClrHeap GetHeap() { if (_heap == null) _heap = new DesktopGCHeap(this, null); return _heap; }
public SpecialType(DesktopGCHeap heap, string name) : base(heap, heap.DesktopRuntime.ErrorModule, 0) { _name = name; }
internal DesktopCCWData(DesktopGCHeap heap, ulong ccw, ICCWData data) { _addr = ccw; _ccw = data; _heap = heap; }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { m_name = name; m_field = data; m_attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) { m_type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); } if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } } if (m_type == null) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } else if (ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } }
internal DesktopHeapType(Func <string> typeNameFactory, DesktopModule module, uint token, ulong mt, IMethodTableData mtData, DesktopGCHeap heap) : base(mt, heap, module, token) { _name = new Lazy <string>(typeNameFactory); Shared = mtData.Shared; _parent = mtData.Parent; _baseSize = mtData.BaseSize; _componentSize = mtData.ComponentSize; _containsPointers = mtData.ContainsPointers; _hasMethods = mtData.NumMethods > 0; }
public override ClrHeap GetHeap() { if (_heap == null) { if (HasArrayComponentMethodTables) _heap = new LegacyGCHeap(this); else _heap = new V46GCHeap(this); } return _heap; }
public DesktopHeapType(ulong mt, DesktopGCHeap heap, DesktopBaseModule module, uint token) : base(mt, heap, module, token) { }
internal LockInspection(DesktopGCHeap heap, DesktopRuntimeBase runtime) { _heap = heap; _runtime = runtime; }
private static BaseDesktopHeapType GetType(DesktopGCHeap heap, IFieldData data, IntPtr sig, int sigLen, ClrElementType elementType) { BaseDesktopHeapType result = null; ulong mt = data.TypeMethodTable; if (mt != 0) { result = (BaseDesktopHeapType)heap.GetTypeByMethodTable(mt, 0); } if (result == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int etype = 0; if (res = sigParser.GetCallingConvInfo(out int sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); // Generic instantiation if (etype == 0x15) { res = res && sigParser.GetElemType(out etype); } if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { result = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { result = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { result = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; sigParser.GetToken(out int token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } result = heap.CreatePointerType(innerType, type, null); } else if (type == ClrElementType.Object || type == ClrElementType.Class) { result = (BaseDesktopHeapType)heap.ObjectType; } else { // struct, then try to get the token int token = 0; if (etype == 0x11 || etype == 0x12) { res = res && sigParser.GetToken(out token); } if (token != 0) { result = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, (uint)token); } if (result == null) { if ((result = (BaseDesktopHeapType)heap.GetBasicType((ClrElementType)etype)) == null) { result = heap.ErrorType; } } } } } if (result == null) { result = (BaseDesktopHeapType)heap.GetBasicType(elementType); } } else if (elementType != ClrElementType.Class) { result.ElementType = elementType; } if (result.IsArray && result.ComponentType == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int etype = 0; if (res = sigParser.GetCallingConvInfo(out int sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); res = res && sigParser.GetElemType(out etype); // Generic instantiation if (etype == 0x15) { res = res && sigParser.GetElemType(out etype); } // If it's a class or struct, then try to get the token int token = 0; if (etype == 0x11 || etype == 0x12) { res = res && sigParser.GetToken(out token); } if (token != 0) { result.ComponentType = heap.GetGCHeapTypeFromModuleAndToken(data.Module, (uint)token); } else if (result.ComponentType == null) { if ((result.ComponentType = heap.GetBasicType((ClrElementType)etype)) == null) { result.ComponentType = heap.ErrorType; } } } } return(result); }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { m_name = name; m_field = data; m_attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) m_type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } if (m_type == null) m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } else if (ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } }
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen) { m_field = field; m_name = name; m_attributes = attributes; m_type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); m_defaultValue = defaultValue; m_heap = heap; if (m_type != null && ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } m_containingType = containingType; if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } } if (m_type == null) { m_type = (BaseDesktopHeapType)TryBuildType(m_heap); } if (m_type == null) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } }
public PrimitiveType(DesktopGCHeap heap, ClrElementType type) : base(0, heap, heap.DesktopRuntime.ErrorModule, 0) { ElementType = type; }
internal DesktopCCWData(DesktopGCHeap heap, Address ccw, ICCWData data) { _addr = ccw; _ccw = data; _heap = heap; }
internal DesktopHeapType(string typeName, DesktopModule module, uint token, ulong mt, IMethodTableData mtData, DesktopGCHeap heap) : base(heap, module, token) { _name = typeName; _constructedMT = mt; Shared = mtData.Shared; _parent = mtData.Parent; _baseSize = mtData.BaseSize; _componentSize = mtData.ComponentSize; _containsPointers = mtData.ContainsPointers; _hasMethods = mtData.NumMethods > 0; }
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name) { m_field = field; m_name = name; m_type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); }
internal DesktopRCWData(DesktopGCHeap heap, Address rcw, IRCWData data) { _addr = rcw; _rcw = data; _heap = heap; _osThreadID = uint.MaxValue; }
public BaseDesktopHeapType(DesktopGCHeap heap, DesktopBaseModule module, uint token) { DesktopHeap = heap; DesktopModule = module; _token = token; }
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen) { _field = field; _name = name; _attributes = attributes; _type = (BaseDesktopHeapType)heap.GetTypeByMethodTable(field.TypeMethodTable, 0); _defaultValue = defaultValue; _heap = heap; _token = field.FieldToken; if (_type != null && ElementType != ClrElementType.Class) { _type.ElementType = ElementType; } _containingType = containingType; if (_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int etype = 0; if (res = sigParser.GetCallingConvInfo(out int sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { _type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { _type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { _type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; sigParser.GetToken(out int token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(field.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } _type = heap.CreatePointerType(innerType, type, null); } } } } if (_type == null) { _typeResolver = new Lazy <ClrType>(() => { ClrType type = (BaseDesktopHeapType)TryBuildType(_heap); if (type == null) { type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } return(type); }); } }
internal DesktopHeapType(string typeName, DesktopModule module, uint token, ulong mt, IMethodTableData mtData, DesktopGCHeap heap, int index) : base(heap, module, token) { m_name = typeName; m_index = index; m_handle = mt; Shared = mtData.Shared; m_parent = mtData.Parent; m_baseSize = mtData.BaseSize; m_componentSize = mtData.ComponentSize; m_containsPointers = mtData.ContainsPointers; m_hasMethods = mtData.NumMethods > 0; }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { _name = name; _field = data; _attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) { _type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); } if (_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { _type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { _type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { _type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; int token; sigParser.GetToken(out token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } _type = heap.CreatePointerType(innerType, type, null); } } } if (_type == null) { _type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } else if (ElementType != ClrElementType.Class) { _type.ElementType = ElementType; } }
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen) { m_field = field; m_name = name; m_attributes = attributes; m_type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); m_defaultValue = defaultValue; m_heap = heap; if (m_type != null && ElementType != ClrElementType.Class) m_type.SetElementType(ElementType); m_containingType = containingType; if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } if (m_type == null) m_type = (BaseDesktopHeapType)TryBuildType(m_heap); if (m_type == null) m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } }
public ErrorType(DesktopGCHeap heap) : base(0, heap, heap.DesktopRuntime.ErrorModule, 0) { }
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name) { _field = field; _name = name; _type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { _name = name; _field = data; _attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) _type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); if (_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) _type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) _type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else _type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; int token; sigParser.GetToken(out token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } _type = heap.CreatePointerType(innerType, type, null); } } } if (_type == null) _type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } else if (ElementType != ClrElementType.Class) { _type.ElementType = ElementType; } }
public DesktopPointerType(DesktopGCHeap heap, DesktopBaseModule module, ClrElementType eltype, uint token, string nameHint) : base(heap, module, token) { ElementType = ClrElementType.Pointer; _pointerElement = eltype; if (nameHint != null) BuildName(nameHint); }
internal override IList <ClrStackFrame> GetExceptionStackTrace(ulong obj, ClrType type) { List <ClrStackFrame> result = new List <ClrStackFrame>(); if (!GetStackTraceFromField(type, obj, out ulong _stackTrace)) { if (!ReadPointer(obj + GetStackTraceOffset(), out _stackTrace)) { return(result); } } if (_stackTrace == 0) { return(result); } DesktopGCHeap heap = (DesktopGCHeap)Heap; ClrType stackTraceType = heap.GetObjectType(_stackTrace); if (stackTraceType == null) { stackTraceType = heap.ArrayType; } if (!stackTraceType.IsArray) { return(result); } int len = stackTraceType.GetArrayLength(_stackTrace); if (len == 0) { return(result); } int elementSize = CLRVersion == DesktopVersion.v2 ? IntPtr.Size * 4 : IntPtr.Size * 3; ulong dataPtr = _stackTrace + (ulong)(IntPtr.Size * 2); if (!ReadPointer(dataPtr, out ulong count)) { return(result); } // Skip size and header dataPtr += (ulong)(IntPtr.Size * 2); DesktopThread thread = null; for (int i = 0; i < (int)count; ++i) { if (!ReadPointer(dataPtr, out ulong ip)) { break; } if (!ReadPointer(dataPtr + (ulong)IntPtr.Size, out ulong sp)) { break; } if (!ReadPointer(dataPtr + (ulong)(2 * IntPtr.Size), out ulong md)) { break; } if (i == 0) { thread = (DesktopThread)GetThreadByStackAddress(sp); } result.Add(new DesktopStackFrame(this, thread, null, ip, sp, md)); dataPtr += (ulong)elementSize; } return(result); }
public DesktopArrayType(DesktopGCHeap heap, DesktopBaseModule module, ClrElementType eltype, int ranks, uint token, string nameHint) : base(heap, module, token) { ElementType = ClrElementType.Array; _arrayElement = eltype; _ranks = ranks; if (nameHint != null) BuildName(nameHint); }
public ErrorType(DesktopGCHeap heap) : base(heap, heap.DesktopRuntime.ErrorModule, 0) { }