mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00

[0.2.x] added : getCurrentThreadId routine ( Return TID of the current thread ( user mode only ) ) [0.2.x] added : eventHandler.onExecutionStatusChange method ( Triggered execution status changed ) git-svn-id: https://pykd.svn.codeplex.com/svn@82898 9b283d60-5439-405e-af05-b73fd8c4d996
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
"""Execution status event test"""
|
|
|
|
import unittest
|
|
import target
|
|
import pykd
|
|
import testutils
|
|
|
|
class StatusChangeHandler(pykd.eventHandler):
|
|
|
|
def __init__(self):
|
|
pykd.eventHandler.__init__(self)
|
|
self.breakCount = 0
|
|
|
|
|
|
def onExecutionStatusChange(self, executionStatus):
|
|
if executionStatus == pykd.executionStatus.Break:
|
|
self.breakCount = self.breakCount + 1
|
|
|
|
|
|
class EhStatusTest(unittest.TestCase):
|
|
"""Execution status event test"""
|
|
|
|
def testException(self):
|
|
"""Start new process and track exceptions"""
|
|
_locProcessId = pykd.startProcess( target.appPath + " -testChangeStatus" )
|
|
with testutils.ContextCallIt( testutils.KillProcess(_locProcessId) ) as killStartedProcess :
|
|
|
|
pykd.go() #skip initial break
|
|
|
|
statusChangeHandler = StatusChangeHandler()
|
|
|
|
pykd.go()
|
|
pykd.go()
|
|
|
|
self.assertEqual( 2, statusChangeHandler.breakCount )
|
|
|