[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:
SND\kernelnet_cp 2013-03-12 07:32:26 +00:00 committed by Mikhail I. Izmestev
parent df0be475c8
commit 0c548cefb6
4 changed files with 18 additions and 5 deletions

View File

@ -1521,15 +1521,20 @@ HRESULT STDMETHODCALLTYPE DebugEngine::ChangeEngineState(
HandlerList::iterator it = m_handlers.begin();
if ( ( ( Flags & DEBUG_CES_EXECUTION_STATUS ) != 0 ) &&
( ( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 ) &&
(ULONG)Argument != previousExecutionStatus )
{
for ( ; it != m_handlers.end(); ++it )
{
if ( ( Flags & DEBUG_CES_EXECUTION_STATUS ) != 0 &&
( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 )
{
PyThread_StateSave pyThreadSave( it->pystate );
it->callback->onExecutionStatusChange( (ULONG)Argument );
}
previousExecutionStatus = (ULONG)Argument;
}
return S_OK;

View File

@ -104,6 +104,10 @@ public:
void registerCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
void removeCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );
DebugEngine() :
previousExecutionStatus( DebugStatusNoChange )
{}
private:
std::auto_ptr<DbgEngBind> m_bind;
@ -123,6 +127,8 @@ private:
boost::recursive_mutex m_handlerLock;
HandlerList m_handlers;
ULONG previousExecutionStatus;
};
///////////////////////////////////////////////////////////////////////////////////

View File

@ -15,8 +15,6 @@ class ExceptionHandler(pykd.eventHandler):
self.accessViolationOccured = exceptInfo.ExceptionCode == 0xC0000005
print exceptInfo
if self.accessViolationOccured:
self.param0 = exceptInfo.Parameters[0]
self.param1 = exceptInfo.Parameters[1]

View File

@ -10,11 +10,14 @@ class StatusChangeHandler(pykd.eventHandler):
def __init__(self):
pykd.eventHandler.__init__(self)
self.breakCount = 0
self.goCount = 0
def onExecutionStatusChange(self, executionStatus):
if executionStatus == pykd.executionStatus.Break:
self.breakCount = self.breakCount + 1
if executionStatus == pykd.executionStatus.Go:
self.goCount = self.goCount + 1
class EhStatusTest(unittest.TestCase):
@ -33,4 +36,5 @@ class EhStatusTest(unittest.TestCase):
pykd.go()
self.assertEqual( 2, statusChangeHandler.breakCount )
self.assertEqual( statusChangeHandler.breakCount, statusChangeHandler.goCount )