Пример #1
0
    public static string GetAddressDescription(/*DebuggedModule module,*/AD7Engine engine, uint ip)
    {
      AD7StackFrame d = new AD7StackFrame(engine, engine.mThread, engine.mProcess);
      FRAMEINFO info;
      d.SetFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS, out info);
      return info.m_bstrFuncName;

      //string location = ip.ToString("x8", CultureInfo.InvariantCulture);

      //if (module != null)
      {
        //  string moduleName = System.IO.Path.GetFileName(module.Name);
        //  location = string.Concat(moduleName, "!", location);
      }

      //return location;
    }
Пример #2
0
        public static string GetAddressDescription(/*DebuggedModule module,*/ AD7Engine engine, uint ip)
        {
            AD7StackFrame d = new AD7StackFrame(engine, engine.mThread, engine.mProcess);
            FRAMEINFO     info;

            d.SetFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS, out info);
            return(info.m_bstrFuncName);

            //string location = ip.ToString("x8", CultureInfo.InvariantCulture);

            //if (module != null)
            {
                //  string moduleName = System.IO.Path.GetFileName(module.Name);
                //  location = string.Concat(moduleName, "!", location);
            }

            //return location;
        }
Пример #3
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)
            {
                // 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);
        }
Пример #4
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;
    }
Пример #5
0
 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];
     }
 }
Пример #6
0
 public AD7Expression(DebugLocalInfo pVar, AD7Process pProcess, AD7StackFrame pStackFrame)
 {
     this.m_var      = pVar;
     this.Process    = pProcess;
     this.StackFrame = pStackFrame;
 }
Пример #7
0
 public AD7Expression(DebugLocalInfo pVar, AD7Process pProcess, AD7StackFrame pStackFrame)
 {
     this.m_var = pVar;
     this.Process = pProcess;
     this.StackFrame = pStackFrame;
 }