public override Address GetAddress(ClrAppDomain appDomain) { if (_containingType == null) return 0; bool shared = _containingType.Shared; IDomainLocalModuleData data = null; if (shared) { Address id = _containingType.DesktopModule.ModuleId; data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id); if (!IsInitialized(data)) return 0; } else { Address modAddr = _containingType.GetModuleAddress(appDomain); if (modAddr != 0) data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(modAddr); } if (data == null) return 0; Address addr; if (DesktopRuntimeBase.IsPrimitive(ElementType)) addr = data.NonGCStaticDataStart + _field.Offset; else addr = data.GCStaticDataStart + _field.Offset; return addr; }
internal DesktopAppDomain(DesktopRuntimeBase runtime, IAppDomainData data, string name) { _address = data.Address; _id = data.Id; _name = name; _runtime = runtime; }
private GCDesc FillGCDesc() { DesktopRuntimeBase runtime = DesktopHeap.DesktopRuntime; Debug.Assert(_constructedMT != 0, "Attempted to fill GC desc with a constructed (not real) type."); if (!runtime.ReadDword(_constructedMT - (ulong)IntPtr.Size, out int entries)) { return(null); } // Get entries in map if (entries < 0) { entries = -entries; } int slots = 1 + entries * 2; byte[] buffer = new byte[slots * IntPtr.Size]; if (!runtime.ReadMemory(_constructedMT - (ulong)(slots * IntPtr.Size), buffer, buffer.Length, out int read) || read != buffer.Length) { return(null); } // Construct the gc desc return(new GCDesc(buffer)); }
internal MemoryRegion(DesktopRuntimeBase clr, ulong addr, ulong size, ClrMemoryRegionType type) { Address = addr; Size = size; _runtime = clr; Type = type; }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong sp, string method) { m_sp = sp; m_frameName = method; m_type = ClrStackFrameType.Runtime; m_runtime = runtime; }
internal static ClrMethod Create(DesktopRuntimeBase runtime, IMethodDescData mdData) { if (mdData == null) return null; DesktopModule module = runtime.GetModule(mdData.Module); return Create(runtime, module != null ? module.GetMetadataImport() : null, mdData); }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong sp, string method, ClrMethod innerMethod) { _runtime = runtime; _sp = sp; _frameName = method ?? "Unknown"; _type = ClrStackFrameType.Runtime; _method = innerMethod; }
internal DesktopAppDomain(DesktopRuntimeBase runtime, IAppDomainData data, string name) { _address = data.Address; _id = data.Id; _name = name; _internalId = s_internalId++; _runtime = runtime; }
internal MemoryRegion(DesktopRuntimeBase clr, ulong addr, ulong size, ClrMemoryRegionType type, ClrAppDomain domain) { Address = addr; Size = size; _runtime = clr; Type = type; _domainModuleHeap = domain.Address; }
internal DesktopAppDomain(DesktopRuntimeBase runtime, IAppDomainData data, string name) { _address = data.Address; Id = data.Id; Name = name; InternalId = s_internalId++; _runtime = runtime; }
internal DesktopAppDomain(DesktopRuntimeBase runtime, IAppDomainData data, string name) { m_address = data.Address; m_id = data.Id; m_name = name; m_internalId = s_internalId++; m_runtime = runtime; }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong sp, ulong md) { _runtime = runtime; _sp = sp; _frameName = _runtime.GetNameForMD(md) ?? "Unknown"; _type = ClrStackFrameType.Runtime; InitMethod(md); }
internal MemoryRegion(DesktopRuntimeBase clr, ulong addr, ulong size, ClrMemoryRegionType type, uint heap, GCSegmentType seg) { Address = addr; Size = size; _runtime = clr; Type = type; _domainModuleHeap = heap; _segmentType = seg; }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong ip, ulong sp, ulong md) { _runtime = runtime; _ip = ip; _sp = sp; _frameName = _runtime.GetNameForMD(md) ?? "Unknown"; _type = ClrStackFrameType.ManagedMethod; InitMethod(md); }
public override Address GetAddress(ClrAppDomain appDomain, ClrThread thread) { if (_type == null) return 0; DesktopRuntimeBase runtime = _type.DesktopHeap.DesktopRuntime; IModuleData moduleData = runtime.GetModuleData(_field.Module); return runtime.GetThreadStaticPointer(thread.Address, (ClrElementType)_field.CorElementType, (uint)Offset, (uint)moduleData.ModuleId, _type.Shared); }
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, byte[] context, ulong sp, string method, ClrMethod innerMethod) { _runtime = runtime; _thread = thread; _context = context; StackPointer = sp; _frameName = method ?? "Unknown"; _type = ClrStackFrameType.Runtime; _method = innerMethod; }
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, byte[] context, ulong sp, ulong md) { _runtime = runtime; _thread = thread; _context = context; StackPointer = sp; _frameName = _runtime.GetNameForMD(md) ?? "Unknown"; _type = ClrStackFrameType.Runtime; InitMethod(md); }
internal static ClrMethod Create(DesktopRuntimeBase runtime, IMethodDescData mdData) { if (mdData == null) { return(null); } DesktopModule module = runtime.GetModule(mdData.Module); return(Create(runtime, module?.GetMetadataImport(), mdData)); }
public DesktopMethod(DesktopRuntimeBase runtime, ulong md, IMethodDescData mdData, MethodAttributes attrs) { m_runtime = runtime; m_sig = runtime.GetNameForMD(md); m_ip = mdData.NativeCodeAddr; m_jit = mdData.JITType; m_attrs = attrs; m_token = mdData.MDToken; var heap = (DesktopGCHeap)runtime.GetHeap(); m_type = heap.GetGCHeapType(mdData.MethodTable, 0); }
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, ulong ip, ulong sp, ulong md) { _runtime = runtime; _thread = thread; _ip = ip; _sp = sp; _frameName = _runtime.GetNameForMD(md) ?? "Unknown"; _type = ClrStackFrameType.ManagedMethod; InitMethod(md); }
public DesktopMethod(DesktopRuntimeBase runtime, ulong md, IMethodDescData mdData, MethodAttributes attrs) { _runtime = runtime; _sig = runtime.GetNameForMD(md); _ip = mdData.NativeCodeAddr; _jit = mdData.JITType; _attrs = attrs; _token = mdData.MDToken; var heap = runtime.GetHeap(); _type = (DesktopHeapType)heap.GetTypeByMethodTable(mdData.MethodTable, 0); }
public override Address GetAddress(ClrAppDomain appDomain, ClrThread thread) { if (m_type == null) { return(0); } DesktopRuntimeBase runtime = m_type.m_heap.m_runtime; IModuleData moduleData = runtime.GetModuleData(m_field.Module); return(runtime.GetThreadStaticPointer(thread.Address, (ClrElementType)m_field.CorElementType, (uint)Offset, (uint)moduleData.ModuleId, m_type.Shared)); }
public DesktopThreadPool(DesktopRuntimeBase runtime, IThreadPoolData data) { m_runtime = runtime; m_totalThreads = data.TotalThreads; m_runningThreads = data.RunningThreads; m_idleThreads = data.IdleThreads; m_minThreads = data.MinThreads; m_maxThreads = data.MaxThreads; m_minCP = data.MinCP; m_maxCP = data.MaxCP; m_cpu = data.CPU; m_freeCP = data.NumFreeCP; m_maxFreeCP = data.MaxFreeCP; }
public DesktopThreadPool(DesktopRuntimeBase runtime, IThreadPoolData data) { _runtime = runtime; TotalThreads = data.TotalThreads; RunningThreads = data.RunningThreads; IdleThreads = data.IdleThreads; MinThreads = data.MinThreads; MaxThreads = data.MaxThreads; MinCompletionPorts = data.MinCP; MaxCompletionPorts = data.MaxCP; CpuUtilization = data.CPU; FreeCompletionPortCount = data.NumFreeCP; MaxFreeCompletionPorts = data.MaxFreeCP; }
public DesktopModule(DesktopRuntimeBase runtime, IModuleData data, string name, string assemblyName, ulong size) : base(runtime) { Revision = runtime.Revision; _imageBase = data.ImageBase; _assemblyName = assemblyName; _isPE = data.IsPEFile; _reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\"); _name = name; ModuleId = data.ModuleId; _size = size; _metadata = data.LegacyMetaDataImport as ICorDebug.IMetadataImport; }
public DesktopThreadPool(DesktopRuntimeBase runtime, IThreadPoolData data) { _runtime = runtime; _totalThreads = data.TotalThreads; _runningThreads = data.RunningThreads; _idleThreads = data.IdleThreads; _minThreads = data.MinThreads; _maxThreads = data.MaxThreads; _minCP = data.MinCP; _maxCP = data.MaxCP; _cpu = data.CPU; _freeCP = data.NumFreeCP; _maxFreeCP = data.MaxFreeCP; }
internal static DesktopMethod Create(DesktopRuntimeBase runtime, ICorDebug.IMetadataImport metadata, IMethodDescData mdData) { if (mdData == null) { return(null); } MethodAttributes attrs = 0; if (metadata?.GetMethodProps(mdData.MDToken, out int pClass, null, 0, out int methodLength, out attrs, out IntPtr blob, out uint blobLen, out uint codeRva, out uint implFlags) < 0) { attrs = 0; } return(new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs)); }
public DesktopMethod(DesktopRuntimeBase runtime, ulong md, IMethodDescData mdData, MethodAttributes attrs) { _runtime = runtime; _sig = runtime.GetNameForMD(md); _ip = mdData.NativeCodeAddr; CompilationType = mdData.JITType; _attrs = attrs; _token = mdData.MDToken; GCInfo = mdData.GCInfo; ClrHeap heap = runtime.Heap; _type = (DesktopHeapType)heap.GetTypeByMethodTable(mdData.MethodTable, 0); HotColdInfo = new HotColdRegions { HotStart = _ip, HotSize = mdData.HotSize, ColdStart = mdData.ColdStart, ColdSize = mdData.ColdSize }; }
internal static DesktopMethod Create(DesktopRuntimeBase runtime, MetaDataImport metadata, IMethodDescData mdData) { if (mdData == null) { return(null); } MethodAttributes attrs = new MethodAttributes(); if (metadata != null) { attrs = metadata.GetMethodAttributes((int)mdData.MDToken); } return(new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs)); }
public override ulong GetAddress(ClrAppDomain appDomain) { if (_containingType == null) { return(0); } bool shared = _containingType.Shared; IDomainLocalModuleData data = null; if (shared) { ulong id = _containingType.DesktopModule.ModuleId; data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id); if (!IsInitialized(data)) { return(0); } } else { ulong modAddr = _containingType.GetModuleAddress(appDomain); if (modAddr != 0) { data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(modAddr); } } if (data == null) { return(0); } ulong addr; if (DesktopRuntimeBase.IsPrimitive(ElementType)) { addr = data.NonGCStaticDataStart + _field.Offset; } else { addr = data.GCStaticDataStart + _field.Offset; } return(addr); }
internal static DesktopMethod Create(DesktopRuntimeBase runtime, ICorDebug.IMetadataImport metadata, IMethodDescData mdData) { if (mdData == null) return null; MethodAttributes attrs = (MethodAttributes)0; if (metadata != null) { int pClass, methodLength; uint blobLen, codeRva, implFlags; IntPtr blob; if (metadata.GetMethodProps(mdData.MDToken, out pClass, null, 0, out methodLength, out attrs, out blob, out blobLen, out codeRva, out implFlags) < 0) attrs = (MethodAttributes)0; } return new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs); }
public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName) : base(runtime) { _address = address; Revision = runtime.Revision; ImageBase = data.ImageBase; AssemblyName = assemblyName; _isPE = data.IsPEFile; IsDynamic = data.IsReflection || string.IsNullOrEmpty(name); _name = name; ModuleId = data.ModuleId; ModuleIndex = data.ModuleIndex; MetadataAddress = data.MetdataStart; MetadataLength = data.MetadataLength; AssemblyId = data.Assembly; _size = new Lazy <ulong>(() => runtime.GetModuleSize(address)); }
internal static DesktopMethod Create(DesktopRuntimeBase runtime, IMetadata metadata, IMethodDescData mdData) { if (mdData == null) return null; MethodAttributes attrs = (MethodAttributes)0; if (metadata != null) { int pClass, methodLength; uint blobLen, codeRva, implFlags; IntPtr blob; if (metadata.GetMethodProps(mdData.MDToken, out pClass, null, 0, out methodLength, out attrs, out blob, out blobLen, out codeRva, out implFlags) < 0) attrs = (MethodAttributes)0; } return new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs); }
public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName, ulong size) : base(runtime) { _address = address; Revision = runtime.Revision; _imageBase = data.ImageBase; _assemblyName = assemblyName; _isPE = data.IsPEFile; _reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\"); _name = name; ModuleId = data.ModuleId; ModuleIndex = data.ModuleIndex; _metadataStart = data.MetdataStart; _metadataLength = data.MetadataLength; _assemblyAddress = data.Assembly; _size = size; if (!runtime.DataReader.IsMinidump) { // This is very expensive in the minidump case, as we may be heading out to the symbol server or // reading multiple files from disk. Only optimistically fetch this data if we have full memory. _metadata = data.LegacyMetaDataImport as ICorDebug.IMetadataImport; } else { // If we are a minidump and metadata isn't mapped in, attempt to fetch this module from the symbol server // on a background thread. #if !V2_SUPPORT if (_isPE && _metadataStart != 0 && _metadataLength > 0) { int read; byte[] tmp = new byte[1]; if (!_runtime.DataReader.ReadMemory(_metadataStart, tmp, 1, out read) || read == 0) { int filesize, imagesize; if (PEFile.TryGetIndexProperties(new ReadVirtualStream(_runtime.DataReader, (long)data.ImageBase, (long)size), true, out imagesize, out filesize)) { _runtime.DataTarget.SymbolLocator.PrefetchBinary(Path.GetFileName(assemblyName), imagesize, filesize); } } } #endif } }
public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName, ulong size) : base(runtime) { Revision = runtime.Revision; _imageBase = data.ImageBase; _assemblyName = assemblyName; _isPE = data.IsPEFile; _reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\"); _name = name; ModuleId = data.ModuleId; ModuleIndex = data.ModuleIndex; _metadataStart = data.MetdataStart; _metadataLength = data.MetadataLength; _assemblyAddress = data.Assembly; _size = size; if (!runtime.DataReader.IsMinidump) { // This is very expensive in the minidump case, as we may be heading out to the symbol server or // reading multiple files from disk. Only optimistically fetch this data if we have full memory. _metadata = data.LegacyMetaDataImport as ICorDebug.IMetadataImport; } else { // If we are a minidump and metadata isn't mapped in, attempt to fetch this module from the symbol server // on a background thread. #if !V2_SUPPORT if (_isPE && _metadataStart != 0 && _metadataLength > 0) { int read; byte[] tmp = new byte[1]; if (!_runtime.DataReader.ReadMemory(_metadataStart, tmp, 1, out read) || read == 0) { int filesize, imagesize; if (PEFile.TryGetIndexProperties(new ReadVirtualStream(_runtime.DataReader, (long)data.ImageBase, (long)size), true, out imagesize, out filesize)) _runtime.DataTarget.SymbolLocator.PrefetchBinary(Path.GetFileName(assemblyName), imagesize, filesize); } } #endif } }
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, ulong sp, ulong md) { _runtime = runtime; _thread = thread; _sp = sp; _frameName = _runtime.GetNameForMD(md) ?? "Unknown"; _type = ClrStackFrameType.Runtime; InitMethod(md); }
public DesktopBaseModule(DesktopRuntimeBase runtime) { _runtime = runtime; }
public ErrorModule(DesktopRuntimeBase runtime) : base(runtime) { }
public HandleTableWalker(DesktopRuntimeBase dac) { m_runtime = dac; m_heap = dac.GetHeap(); Handles = new List<ClrHandle>(); }
internal override bool TraverseHeap(ulong heap, DesktopRuntimeBase.LoaderHeapTraverse callback) { byte[] input = new byte[sizeof(ulong) * 2]; WriteValueToBuffer(heap, input, 0); WriteValueToBuffer(Marshal.GetFunctionPointerForDelegate(callback), input, sizeof(ulong)); return Request(DacRequests.LOADERHEAP_TRAVERSE, input, null); }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong sp, string method, ClrMethod innerMethod) { m_sp = sp; m_frameName = method; m_type = ClrStackFrameType.Runtime; m_method = innerMethod; m_runtime = runtime; }
public DesktopStackFrame(DesktopRuntimeBase runtime, ulong ip, ulong sp, string method) { m_ip = ip; m_sp = sp; m_frameName = method; m_type = ClrStackFrameType.ManagedMethod; m_runtime = runtime; }
public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName, ulong size) { Revision = runtime.Revision; _imageBase = data.ImageBase; _runtime = runtime; _assemblyName = assemblyName; _isPE = data.IsPEFile; _reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\"); _name = name; ModuleId = data.ModuleId; ModuleIndex = data.ModuleIndex; _metadataStart = data.MetdataStart; _metadataLength = data.MetadataLength; _assemblyAddress = data.Assembly; _address = address; _size = size; // This is very expensive in the minidump case, as we may be heading out to the symbol server or // reading multiple files from disk. Only optimistically fetch this data if we have full memory. if (!runtime.DataReader.IsMinidump) _metadata = data.LegacyMetaDataImport as IMetadata; }
public AppDomainHeapWalker(DesktopRuntimeBase runtime) { mRuntime = runtime; mDelegate = new DesktopRuntimeBase.LoaderHeapTraverse(VisitOneHeap); }
internal override bool TraverseHeap(ulong heap, DesktopRuntimeBase.LoaderHeapTraverse callback) { bool res = _sos.TraverseLoaderHeap(heap, Marshal.GetFunctionPointerForDelegate(callback)) >= 0; GC.KeepAlive(callback); return res; }
internal LockInspection(DesktopGCHeap heap, DesktopRuntimeBase runtime) { _heap = heap; _runtime = runtime; }
internal override bool TraverseStubHeap(ulong appDomain, int type, DesktopRuntimeBase.LoaderHeapTraverse callback) { bool res = _sos.TraverseVirtCallStubHeap(appDomain, (uint)type, Marshal.GetFunctionPointerForDelegate(callback)) >= 0; GC.KeepAlive(callback); return res; }
internal DesktopThread(DesktopRuntimeBase clr, IThreadData thread, ulong address, bool finalizer) : base(thread, address, finalizer) { _runtime = clr; }