From 3e03e588ef2942beb9b9020216b5bb65b54e2f06 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Sun, 14 Dec 2014 11:04:02 +0000 Subject: [PATCH] [0.3.x] added : added EventHandler::onChangeLocalScope ( the current local scope has been changed ) git-svn-id: https://pykd.svn.codeplex.com/svn@89457 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pyeventhandler.cpp | 22 ++++++++++++++++++++++ pykd/pyeventhandler.h | 1 + pykd/pykdver.h | 2 +- pykd/pymod.cpp | 6 +++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/pykd/pyeventhandler.cpp b/pykd/pyeventhandler.cpp index b5175b0..2d591fd 100644 --- a/pykd/pyeventhandler.cpp +++ b/pykd/pyeventhandler.cpp @@ -264,6 +264,28 @@ void EventHandler::onCurrentThreadChange(kdlib::THREAD_DEBUG_ID threadid) ///////////////////////////////////////////////////////////////////////////////// +void EventHandler::onChangeLocalScope() +{ + PyEval_RestoreThread( m_pystate ); + + try { + + python::override pythonHandler = get_override("onChangeLocalScope"); + if ( pythonHandler ) + { + pythonHandler(); + } + } + catch (const python::error_already_set &) + { + printException(); + } + + m_pystate = PyEval_SaveThread(); +} + +///////////////////////////////////////////////////////////////////////////////// + Breakpoint::Breakpoint(kdlib::BreakpointPtr bp) { m_pystate = PyThreadState_Get(); diff --git a/pykd/pyeventhandler.h b/pykd/pyeventhandler.h index 0487822..9b5b62a 100644 --- a/pykd/pyeventhandler.h +++ b/pykd/pyeventhandler.h @@ -34,6 +34,7 @@ public: virtual kdlib::DebugCallbackResult onModuleLoad( kdlib::MEMOFFSET_64 offset, const std::wstring &name ); virtual kdlib::DebugCallbackResult onModuleUnload( kdlib::MEMOFFSET_64 offset, const std::wstring &name ); virtual void onCurrentThreadChange(kdlib::THREAD_DEBUG_ID threadid); + virtual void onChangeLocalScope(); private: diff --git a/pykd/pykdver.h b/pykd/pykdver.h index 85809e4..f91c3ed 100644 --- a/pykd/pykdver.h +++ b/pykd/pykdver.h @@ -2,7 +2,7 @@ #define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MINOR 3 #define PYKD_VERSION_SUBVERSION 0 -#define PYKD_VERSION_BUILDNO 13 +#define PYKD_VERSION_BUILDNO 14 #define __VER_STR2__(x) #x #define __VER_STR1__(x) __VER_STR2__(x) diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index eaa4f2a..e18b627 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -894,8 +894,12 @@ BOOST_PYTHON_MODULE( pykd ) "Triggered execution status changed. Parameter - execution status.\n" "There is no return value" ) .def( "onCurrentThreadChange", &EventHandler::onCurrentThreadChange, - "The current thread has changed, which implies that the current target and current process might also have changed.\n" + "The current thread has been changed, which implies that the current target and current process might also have changed.\n" "There is no return value" ) + .def( "onChangeLocalScope", &EventHandler::onChangeLocalScope, + "The current local scope has been changed.\n" + "There is no return value" ) + // .def( "onSymbolsLoaded", &EventHandlerWrap::onSymbolsLoaded, // "Triggered debug symbols loaded. Parameter - module base or 0\n" // "There is no return value")