mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.2.x] fixed : eventHandler.onExecutionStatusChange method
git-svn-id: https://pykd.svn.codeplex.com/svn@82899 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
df0be475c8
commit
0c548cefb6
@ -1521,15 +1521,20 @@ HRESULT STDMETHODCALLTYPE DebugEngine::ChangeEngineState(
|
|||||||
|
|
||||||
HandlerList::iterator it = m_handlers.begin();
|
HandlerList::iterator it = m_handlers.begin();
|
||||||
|
|
||||||
for ( ; it != m_handlers.end(); ++it )
|
if ( ( ( Flags & DEBUG_CES_EXECUTION_STATUS ) != 0 ) &&
|
||||||
|
( ( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 ) &&
|
||||||
|
(ULONG)Argument != previousExecutionStatus )
|
||||||
{
|
{
|
||||||
if ( ( Flags & DEBUG_CES_EXECUTION_STATUS ) != 0 &&
|
|
||||||
( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 )
|
for ( ; it != m_handlers.end(); ++it )
|
||||||
{
|
{
|
||||||
|
|
||||||
PyThread_StateSave pyThreadSave( it->pystate );
|
PyThread_StateSave pyThreadSave( it->pystate );
|
||||||
|
|
||||||
it->callback->onExecutionStatusChange( (ULONG)Argument );
|
it->callback->onExecutionStatusChange( (ULONG)Argument );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousExecutionStatus = (ULONG)Argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -104,6 +104,10 @@ public:
|
|||||||
void registerCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
|
void registerCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
|
||||||
void removeCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
|
void removeCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
|
||||||
|
|
||||||
|
DebugEngine() :
|
||||||
|
previousExecutionStatus( DebugStatusNoChange )
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::auto_ptr<DbgEngBind> m_bind;
|
std::auto_ptr<DbgEngBind> m_bind;
|
||||||
@ -123,6 +127,8 @@ private:
|
|||||||
|
|
||||||
boost::recursive_mutex m_handlerLock;
|
boost::recursive_mutex m_handlerLock;
|
||||||
HandlerList m_handlers;
|
HandlerList m_handlers;
|
||||||
|
|
||||||
|
ULONG previousExecutionStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -15,8 +15,6 @@ class ExceptionHandler(pykd.eventHandler):
|
|||||||
|
|
||||||
self.accessViolationOccured = exceptInfo.ExceptionCode == 0xC0000005
|
self.accessViolationOccured = exceptInfo.ExceptionCode == 0xC0000005
|
||||||
|
|
||||||
print exceptInfo
|
|
||||||
|
|
||||||
if self.accessViolationOccured:
|
if self.accessViolationOccured:
|
||||||
self.param0 = exceptInfo.Parameters[0]
|
self.param0 = exceptInfo.Parameters[0]
|
||||||
self.param1 = exceptInfo.Parameters[1]
|
self.param1 = exceptInfo.Parameters[1]
|
||||||
|
@ -10,11 +10,14 @@ class StatusChangeHandler(pykd.eventHandler):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pykd.eventHandler.__init__(self)
|
pykd.eventHandler.__init__(self)
|
||||||
self.breakCount = 0
|
self.breakCount = 0
|
||||||
|
self.goCount = 0
|
||||||
|
|
||||||
|
|
||||||
def onExecutionStatusChange(self, executionStatus):
|
def onExecutionStatusChange(self, executionStatus):
|
||||||
if executionStatus == pykd.executionStatus.Break:
|
if executionStatus == pykd.executionStatus.Break:
|
||||||
self.breakCount = self.breakCount + 1
|
self.breakCount = self.breakCount + 1
|
||||||
|
if executionStatus == pykd.executionStatus.Go:
|
||||||
|
self.goCount = self.goCount + 1
|
||||||
|
|
||||||
|
|
||||||
class EhStatusTest(unittest.TestCase):
|
class EhStatusTest(unittest.TestCase):
|
||||||
@ -33,4 +36,5 @@ class EhStatusTest(unittest.TestCase):
|
|||||||
pykd.go()
|
pykd.go()
|
||||||
|
|
||||||
self.assertEqual( 2, statusChangeHandler.breakCount )
|
self.assertEqual( 2, statusChangeHandler.breakCount )
|
||||||
|
self.assertEqual( statusChangeHandler.breakCount, statusChangeHandler.goCount )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user