From cd271d70ecf0daf865db984fe6e9e7129707beb7 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Sun, 14 Dec 2014 10:58:29 +0000 Subject: [PATCH] [0.3.x] added : setFrame routine ( change current local scope ) [0.3.x] added : resetFrame routine ( resets the current scope to the default scope of the current thread ) git-svn-id: https://pykd.svn.codeplex.com/svn@89456 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pycpucontext.h | 18 +++++++++++++++++- pykd/pymod.cpp | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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,