[0.2.x] fixed : onExecutionStatusChange triggers break after target has been already stopped

git-svn-id: https://pykd.svn.codeplex.com/svn@83224 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-04-05 07:39:56 +00:00 committed by Mikhail I. Izmestev
parent 1ad8bf412b
commit 31d0a615f9
2 changed files with 18 additions and 7 deletions

View File

@ -1223,6 +1223,9 @@ HRESULT STDMETHODCALLTYPE DebugEngine::ChangeEngineState(
( ( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 ) && ( ( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 ) &&
(ULONG)Argument != previousExecutionStatus ) (ULONG)Argument != previousExecutionStatus )
{ {
if ( previousExecutionStatus == DEBUG_STATUS_NO_DEBUGGEE &&
(ULONG)Argument != DEBUG_STATUS_GO )
return S_OK;
for ( ; it != m_handlers.end(); ++it ) for ( ; it != m_handlers.end(); ++it )
{ {

View File

@ -11,13 +11,15 @@ class StatusChangeHandler(pykd.eventHandler):
pykd.eventHandler.__init__(self) pykd.eventHandler.__init__(self)
self.breakCount = 0 self.breakCount = 0
self.goCount = 0 self.goCount = 0
self.noDebuggee = 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 += 1
if executionStatus == pykd.executionStatus.Go: if executionStatus == pykd.executionStatus.Go:
self.goCount = self.goCount + 1 self.goCount += 1
if executionStatus == pykd.executionStatus.NoDebuggee:
self.noDebuggee += 1
class EhStatusTest(unittest.TestCase): class EhStatusTest(unittest.TestCase):
@ -32,9 +34,15 @@ class EhStatusTest(unittest.TestCase):
statusChangeHandler = StatusChangeHandler() statusChangeHandler = StatusChangeHandler()
try:
while True:
pykd.go() pykd.go()
pykd.go() except pykd.BaseException:
pass
self.assertEqual( 2, statusChangeHandler.breakCount ) self.assertEqual( 2, statusChangeHandler.breakCount )
self.assertEqual( statusChangeHandler.breakCount, statusChangeHandler.goCount ) self.assertEqual( 1, statusChangeHandler.noDebuggee )
self.assertEqual( statusChangeHandler.breakCount + statusChangeHandler.noDebuggee , statusChangeHandler.goCount )