/// <summary> /// Initializes a new instance of the <see cref="VSClrStackFrame"/> class. /// </summary> /// <param name="thread">The thread containing this stack frame.</param> /// <param name="id">The stack frame id.</param> /// <param name="instructionPointer">The instruction pointer.</param> /// <param name="stackPointer">The stack pointer.</param> /// <param name="moduleAddress">The module base address.</param> public VSClrStackFrame(VSClrThread thread, int id, ulong instructionPointer, ulong stackPointer, ulong moduleAddress) { Thread = thread; InstructionPointer = instructionPointer; StackPointer = stackPointer; argumentsCache = SimpleCache.Create(() => CreateVariableCollection(Proxy.GetClrStackFrameArguments(Thread.VSRuntime.Process.Id, Thread.VSRuntime.Id, Thread.SystemId, Id))); localsCache = SimpleCache.Create(() => CreateVariableCollection(Proxy.GetClrStackFrameLocals(Thread.VSRuntime.Process.Id, Thread.VSRuntime.Id, Thread.SystemId, Id))); moduleCache = SimpleCache.Create(() => Thread.VSRuntime.GetModule(moduleAddress)); }
/// <summary> /// Initializes a new instance of the <see cref="VSClrRuntime" /> class. /// </summary> /// <param name="debugger">The Visual Studio debugger.</param> /// <param name="process">The process.</param> /// <param name="id">The runtime identifier.</param> /// <param name="version">The runtime version.</param> public VSClrRuntime(VSDebugger debugger, Process process, int id, ModuleVersion version) { Debugger = debugger; Id = id; Process = process; Version = version; VSHeap = new VSClrHeap(this); clrTypesCache = new DictionaryCache <int, VSClrType>((clrTypeId) => new VSClrType(this, clrTypeId)); threadsAndGcThreads = SimpleCache.Create(() => { Tuple <bool, uint, bool, ulong>[] threadTuples = Proxy.GetClrRuntimeThreads(Process.Id, Id); List <VSClrThread> threads = new List <VSClrThread>(); List <VSClrThread> gcThreads = new List <VSClrThread>(); for (int i = 0; i < threadTuples.Length; i++) { VSClrThread thread = new VSClrThread(this, threadTuples[i].Item2, threadTuples[i].Item3, threadTuples[i].Item4); if (!threadTuples[i].Item1) { gcThreads.Add(thread); } threads.Add(thread); } return(Tuple.Create(threads.ToArray(), gcThreads.ToArray())); }); modulesCache = SimpleCache.Create(() => { ulong[] moduleAddresses = Proxy.GetClrRuntimeModules(Process.Id, Id); VSClrModule[] modules = new VSClrModule[moduleAddresses.Length]; for (int i = 0; i < modules.Length; i++) { modules[i] = new VSClrModule(this, moduleAddresses[i]); } return(modules); }); appDomainsCache = SimpleCache.Create(() => { Tuple <int, string, ulong, string, string>[] tuples = Proxy.GetClrRuntimeAppDomains(Process.Id, Id); VSClrAppDomain[] appDomains = new VSClrAppDomain[tuples.Length]; for (int i = 0; i < tuples.Length; i++) { appDomains[i] = new VSClrAppDomain(this, tuples[i].Item1, tuples[i].Item2, tuples[i].Item3, tuples[i].Item4, tuples[i].Item5); } return(appDomains); }); sharedAppDomainCache = SimpleCache.Create(() => { Tuple <int, string, ulong, string, string> tuple = Proxy.GetClrRuntimeSharedAppDomain(Process.Id, Id); if (tuple.Item1 == int.MinValue) { return(null); } return(new VSClrAppDomain(this, tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5)); }); systemAppDomainCache = SimpleCache.Create(() => { Tuple <int, string, ulong, string, string> tuple = Proxy.GetClrRuntimeSystemAppDomain(Process.Id, Id); if (tuple.Item1 == int.MinValue) { return(null); } return(new VSClrAppDomain(this, tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5)); }); heapCountCache = SimpleCache.Create(() => Proxy.GetClrRuntimeHeapCount(Process.Id, Id)); serverGCCache = SimpleCache.Create(() => Proxy.GetClrRuntimeServerGC(Process.Id, Id)); }