internal ICorDebugFrame GetFrameAt(FrameID frameID) { process.AssertPaused(); ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains(); if (frameID.ChainIndex >= corChainEnum.Count) { throw new ArgumentException("Chain index too big", "chainIndex"); } corChainEnum.Skip(corChainEnum.Count - frameID.ChainIndex - 1); ICorDebugChain corChain = corChainEnum.Next(); if (corChain.IsManaged == 0) { throw new ArgumentException("Chain is not managed", "chainIndex"); } ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames(); if (frameID.FrameIndex >= corFrameEnum.Count) { throw new ArgumentException("Frame index too big", "frameIndex"); } corFrameEnum.Skip(corFrameEnum.Count - frameID.FrameIndex - 1); return(corFrameEnum.Next()); }
internal StackFrame GetStackFrameAt(uint chainIndex, uint frameIndex) { process.AssertPaused(); ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains(); if (chainIndex >= corChainEnum.GetCount()) { throw new DebuggerException("The requested chain index is too big"); } corChainEnum.Skip(corChainEnum.GetCount() - chainIndex - 1); ICorDebugChain corChain = corChainEnum.Next(); if (corChain.IsManaged() == 0) { throw new DebuggerException("The requested chain is not managed"); } ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames(); if (frameIndex >= corFrameEnum.GetCount()) { throw new DebuggerException("The requested frame index is too big"); } corFrameEnum.Skip(corFrameEnum.GetCount() - frameIndex - 1); ICorDebugFrame corFrame = corFrameEnum.Next(); if (!(corFrame is ICorDebugILFrame)) { throw new DebuggerException("The rquested frame is not IL frame"); } StackFrame stackFrame = new StackFrame(this, (ICorDebugILFrame)corFrame, chainIndex, frameIndex); return(stackFrame); }