From 31d0a615f929c64b82972e55bb04880b949592af Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Fri, 5 Apr 2013 07:39:56 +0000 Subject: [PATCH] [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 --- pykd/win/dbgeng.cpp | 3 +++ test/scripts/ehstatustest.py | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/pykd/win/dbgeng.cpp b/pykd/win/dbgeng.cpp index 75abc5c..273cb81 100644 --- a/pykd/win/dbgeng.cpp +++ b/pykd/win/dbgeng.cpp @@ -1223,6 +1223,9 @@ HRESULT STDMETHODCALLTYPE DebugEngine::ChangeEngineState( ( ( Argument & DEBUG_STATUS_INSIDE_WAIT ) == 0 ) && (ULONG)Argument != previousExecutionStatus ) { + if ( previousExecutionStatus == DEBUG_STATUS_NO_DEBUGGEE && + (ULONG)Argument != DEBUG_STATUS_GO ) + return S_OK; for ( ; it != m_handlers.end(); ++it ) { diff --git a/test/scripts/ehstatustest.py b/test/scripts/ehstatustest.py index b119e04..ac7bd11 100644 --- a/test/scripts/ehstatustest.py +++ b/test/scripts/ehstatustest.py @@ -11,13 +11,15 @@ class StatusChangeHandler(pykd.eventHandler): pykd.eventHandler.__init__(self) self.breakCount = 0 self.goCount = 0 - - + self.noDebuggee = 0 + def onExecutionStatusChange(self, executionStatus): if executionStatus == pykd.executionStatus.Break: - self.breakCount = self.breakCount + 1 + self.breakCount += 1 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): @@ -32,9 +34,15 @@ class EhStatusTest(unittest.TestCase): statusChangeHandler = StatusChangeHandler() - pykd.go() - pykd.go() + try: + + while True: + pykd.go() + except pykd.BaseException: + pass + self.assertEqual( 2, statusChangeHandler.breakCount ) - self.assertEqual( statusChangeHandler.breakCount, statusChangeHandler.goCount ) + self.assertEqual( 1, statusChangeHandler.noDebuggee ) + self.assertEqual( statusChangeHandler.breakCount + statusChangeHandler.noDebuggee , statusChangeHandler.goCount ) \ No newline at end of file