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; }
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; }
// 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); }
// 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; }