diff --git a/pykd/pycpucontext.h b/pykd/pycpucontext.h index d94e053..a6a6f14 100644 --- a/pykd/pycpucontext.h +++ b/pykd/pycpucontext.h @@ -105,9 +105,25 @@ python::list getCurrentStack(); inline kdlib::StackFramePtr getCurrentFrame() { AutoRestorePyState pystate; - return kdlib::getStack()->getFrame(0); + return kdlib::getCurrentStackFrame(); } +inline void setCurrentFrame( kdlib::StackFramePtr& stackFrame) { + AutoRestorePyState pystate; + kdlib::setCurrentStackFrame(stackFrame); +} + +inline void setCurrentFrameByIndex( unsigned long frameIndex) { + AutoRestorePyState pystate; + kdlib::StackFramePtr stackFrame = kdlib::getStack()->getFrame(frameIndex); + kdlib::setCurrentStackFrame(stackFrame); +} + +inline void resetCurrentFrame() { + AutoRestorePyState pystate; + kdlib::resetCurrentStackFrame(); +} + inline python::list getParams() { return StackFrameAdapter::getParamsList( getCurrentFrame() ); } diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 8e0ece1..eaa4f2a 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -353,6 +353,12 @@ BOOST_PYTHON_MODULE( pykd ) "Return a current stack as a list of stackFrame objects" ); python::def( "getFrame", pykd::getCurrentFrame, "Return a current stack frame" ); + python::def( "setFrame", pykd::setCurrentFrame, + "Change current local scope" ); + python::def( "setFrame", pykd::setCurrentFrameByIndex, + "Change current local scope" ); + python::def( "resetFrame", pykd::resetCurrentFrame, + "Resets the current local scope to the default scope of the current thread" ); python::def( "getLocals", pykd::getLocals, "Get list of local variables" ); python::def( "getLocal", pykd::getLocal,