// The function verifies that the stackwalker for this thread is "current". The stack-walker will become // invalid when a debugger performs an operation that invalidats active stackwalkers. Examples of such // operations are: // - calling Continue(), calling SetIP() or calling RefreshStack() methods. // // If the current stack-walker is not current, a new stack-walker is created for the thread. The function // also sets the current frame if the stack walker is refreshed. // private void EnsureCurrentStackWalker() { if (m_stackWalker != null && m_stackWalker.IsUsable) { return; } m_stackWalker = m_threadMgr.FrameFactory.CreateStackWalker(this); // initialize the frame index to be the invalid index m_currentFrameIndex = -1; // set m_currentFrame to first non-virtual frame MDbgFrame f = m_stackWalker.GetFrame(0); if (f == null) { return; } // we have at least one frame, so set the frame index to 0 m_currentFrameIndex = 0; while (f != null && f.IsInfoOnly) { f = f.NextUp; if (f != null) { ++m_currentFrameIndex; } } }