コード例 #1
0
        // Retrieves a list of the stack frames for this thread.
        // For the sample engine, enumerating the stack frames requires walking the callstack in the debuggee for this thread
        // and coverting that to an implementation of IEnumDebugFrameInfo2.
        // Real engines will most likely want to cache this information to avoid recomputing it each time it is asked for,
        // and or construct it on demand instead of walking the entire stack.
        int IDebugThread2.EnumFrameInfo(enum_FRAMEINFO_FLAGS aFieldSpec, uint aRadix, out IEnumDebugFrameInfo2 oEnumObject)
        {
            // Check mStackFrame, not address because it is possible for 2 sequential breaks to be on the same address
            // but in that case we would need a new stack frame.
            //
            // EnumFrameInfo is called several times on each break becuase "different callers can call with different flags".
            // We ignore flags through and always return full, but EnumFrameInfo gets called half a dozen times which is slow
            // if we refresh each and every time. So we cache our info.
            if (mProcess.mStackFrame == null || true)
            {
                // Ask the lower-level to perform a stack walk on this thread
                //m_engine.DebuggedProcess.DoStackWalk(this.m_debuggedThread);
                oEnumObject = null;
                try {
                    //System.Collections.Generic.List<X86ThreadContext> stackFrames = this.m_debuggedThread.StackFrames;
                    //int numStackFrames = stackFrames.Count;
                    FRAMEINFO[] xFrameInfoArray;

                    //if (numStackFrames == 0) {
                    // failed to walk any frames. Only return the top frame.

                    xFrameInfoArray = new FRAMEINFO[1];
                    var xFrame = new AD7StackFrame(mEngine, this, mProcess);
                    xFrame.SetFrameInfo((enum_FRAMEINFO_FLAGS)aFieldSpec, out xFrameInfoArray[0]);

                    //} else {
                    //frameInfoArray = new FRAMEINFO[numStackFrames];
                    //for (int i = 0; i < numStackFrames; i++) {
                    //AD7StackFrame frame = new AD7StackFrame(m_engine, this, stackFrames[i]);
                    //frame.SetFrameInfo(dwFieldSpec, out frameInfoArray[i]);
                    //}
                    //}

                    mProcess.mStackFrame = new AD7FrameInfoEnum(xFrameInfoArray);
                } catch (Exception e) {
                    //catch (ComponentException e) {
                    //    return e.HResult;
                    //}
                    return(EngineUtils.UnexpectedException(e));
                }
            }
            oEnumObject = mProcess.mStackFrame;
            return(VSConstants.S_OK);
        }
コード例 #2
0
ファイル: AD7Property.cs プロジェクト: KM198912/PatchedCosmos
 public AD7Property(DebugLocalInfo localInfo, AD7Process process, AD7StackFrame stackFrame)
 {
     m_variableInformation = localInfo;
     mProcess    = process;
     mStackFrame = stackFrame;
     if (localInfo.IsLocal)
     {
         mDebugInfo = mStackFrame.mLocalInfos[m_variableInformation.Index];
     }
     else if (localInfo.IsReference)
     {
         mDebugInfo = new LOCAL_ARGUMENT_INFO()
         {
             TYPENAME = localInfo.Type,
             NAME     = localInfo.Name,
             OFFSET   = localInfo.Offset
         };
     }
     else
     {
         mDebugInfo = mStackFrame.mArgumentInfos[m_variableInformation.Index];
     }
 }
コード例 #3
0
 public AD7Expression(DebugLocalInfo pVar, AD7Process pProcess, AD7StackFrame pStackFrame)
 {
     m_var      = pVar;
     Process    = pProcess;
     StackFrame = pStackFrame;
 }