mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.3.x] added : onModuleLoad/onModuleUnload methods
git-svn-id: https://pykd.svn.codeplex.com/svn@87486 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0e0d147888
commit
33761324e3
@ -249,5 +249,107 @@ kdlib::DebugCallbackResult EventHandler::onException( const kdlib::ExceptionInfo
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
kdlib::DebugCallbackResult EventHandler::onModuleLoad( kdlib::MEMOFFSET_64 offset, const std::wstring &name )
|
||||||
|
{
|
||||||
|
kdlib::DebugCallbackResult result = kdlib::DebugCallbackNoChange;
|
||||||
|
|
||||||
|
PyEval_RestoreThread( m_pystate );
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
python::override pythonHandler = get_override( "onModuleLoad" );
|
||||||
|
if ( !pythonHandler )
|
||||||
|
{
|
||||||
|
result = kdlib::EventHandler::onModuleLoad( offset, name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
python::object resObj = pythonHandler( offset, name );
|
||||||
|
|
||||||
|
if ( resObj.is_none() )
|
||||||
|
{
|
||||||
|
result = kdlib::DebugCallbackNoChange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int retVal = python::extract<int>( resObj );
|
||||||
|
|
||||||
|
if ( retVal >= kdlib::DebugCallbackMax )
|
||||||
|
{
|
||||||
|
result = kdlib::DebugCallbackBreak;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = kdlib::DebugCallbackResult(retVal);
|
||||||
|
|
||||||
|
} while( FALSE );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (const python::error_already_set &)
|
||||||
|
{
|
||||||
|
printException();
|
||||||
|
result = kdlib::DebugCallbackBreak;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pystate = PyEval_SaveThread();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
kdlib::DebugCallbackResult EventHandler::onModuleUnload( kdlib::MEMOFFSET_64 offset, const std::wstring &name )
|
||||||
|
{
|
||||||
|
kdlib::DebugCallbackResult result = kdlib::DebugCallbackNoChange;
|
||||||
|
|
||||||
|
PyEval_RestoreThread( m_pystate );
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
python::override pythonHandler = get_override( "onModuleUnload" );
|
||||||
|
if ( !pythonHandler )
|
||||||
|
{
|
||||||
|
result = kdlib::EventHandler::onModuleUnload( offset, name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
python::object resObj = pythonHandler( offset, name );
|
||||||
|
|
||||||
|
if ( resObj.is_none() )
|
||||||
|
{
|
||||||
|
result = kdlib::DebugCallbackNoChange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int retVal = python::extract<int>( resObj );
|
||||||
|
|
||||||
|
if ( retVal >= kdlib::DebugCallbackMax )
|
||||||
|
{
|
||||||
|
result = kdlib::DebugCallbackBreak;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = kdlib::DebugCallbackResult(retVal);
|
||||||
|
|
||||||
|
} while( FALSE );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (const python::error_already_set &)
|
||||||
|
{
|
||||||
|
printException();
|
||||||
|
result = kdlib::DebugCallbackBreak;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pystate = PyEval_SaveThread();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
} // end namespace pykd
|
} // end namespace pykd
|
||||||
|
@ -75,6 +75,8 @@ public:
|
|||||||
virtual kdlib::DebugCallbackResult onBreakpoint( kdlib::BREAKPOINT_ID bpId );
|
virtual kdlib::DebugCallbackResult onBreakpoint( kdlib::BREAKPOINT_ID bpId );
|
||||||
virtual void onExecutionStatusChange( kdlib::ExecutionStatus executionStatus );
|
virtual void onExecutionStatusChange( kdlib::ExecutionStatus executionStatus );
|
||||||
virtual kdlib::DebugCallbackResult onException( const kdlib::ExceptionInfo &exceptionInfo );
|
virtual kdlib::DebugCallbackResult onException( const kdlib::ExceptionInfo &exceptionInfo );
|
||||||
|
virtual kdlib::DebugCallbackResult onModuleLoad( kdlib::MEMOFFSET_64 offset, const std::wstring &name );
|
||||||
|
virtual kdlib::DebugCallbackResult onModuleUnload( kdlib::MEMOFFSET_64 offset, const std::wstring &name );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define PYKD_VERSION_MAJOR 0
|
#define PYKD_VERSION_MAJOR 0
|
||||||
#define PYKD_VERSION_MINOR 3
|
#define PYKD_VERSION_MINOR 3
|
||||||
#define PYKD_VERSION_SUBVERSION 0
|
#define PYKD_VERSION_SUBVERSION 0
|
||||||
#define PYKD_VERSION_BUILDNO 1
|
#define PYKD_VERSION_BUILDNO 2
|
||||||
|
|
||||||
#define __VER_STR2__(x) #x
|
#define __VER_STR2__(x) #x
|
||||||
#define __VER_STR1__(x) __VER_STR2__(x)
|
#define __VER_STR1__(x) __VER_STR2__(x)
|
||||||
|
@ -840,12 +840,12 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "onBreakpoint", &EventHandler::onBreakpoint,
|
.def( "onBreakpoint", &EventHandler::onBreakpoint,
|
||||||
"Triggered breakpoint event. Parameter is int: ID of breakpoint\n"
|
"Triggered breakpoint event. Parameter is int: ID of breakpoint\n"
|
||||||
"For ignore event method must return eventResult.noChange" )
|
"For ignore event method must return eventResult.noChange" )
|
||||||
// .def( "onModuleLoad", &EventHandlerWrap::OnModuleLoad,
|
.def( "onModuleLoad", &EventHandler::onModuleLoad,
|
||||||
// "Triggered module load event. Parameter are long: module base, string: module name\n"
|
"Triggered module load event. Parameter are long: module base, string: module name\n"
|
||||||
// "For ignore event method must return eventResult.noChange" )
|
"For ignore event method must return eventResult.noChange" )
|
||||||
// .def( "onModuleUnload", &EventHandlerWrap::OnModuleUnload,
|
.def( "onModuleUnload", &EventHandler::onModuleUnload,
|
||||||
// "Triggered module unload event. Parameter are long: module base, string: module name\n"
|
"Triggered module unload event. Parameter are long: module base, string: module name\n"
|
||||||
// "For ignore event method must return eventResult.noChange" )
|
"For ignore event method must return eventResult.noChange" )
|
||||||
.def( "onException", &EventHandler::onException,
|
.def( "onException", &EventHandler::onException,
|
||||||
"Triggered exception event. Parameter - exceptionInfo\n"
|
"Triggered exception event. Parameter - exceptionInfo\n"
|
||||||
"For ignore event method must return eventResult.noChange" )
|
"For ignore event method must return eventResult.noChange" )
|
||||||
|
Loading…
Reference in New Issue
Block a user