2012-07-22 23:23:18 +08:00
|
|
|
"""PyKd test heplers/wrappers"""
|
|
|
|
|
|
|
|
import pykd
|
|
|
|
|
|
|
|
class ContextCallIt:
|
|
|
|
"""Context manager/with statement"""
|
|
|
|
def __init__(self, callIt):
|
|
|
|
self.callIt = callIt
|
|
|
|
|
|
|
|
def __enter__(self):
|
|
|
|
return self
|
|
|
|
|
|
|
|
def __exit__(self, exc_type, exc_value, exc_tb):
|
|
|
|
try: self.callIt()
|
|
|
|
except: pass
|
|
|
|
|
2012-09-04 22:58:50 +08:00
|
|
|
class KillProcess:
|
|
|
|
"""Kill process"""
|
|
|
|
def __init__(self, processId):
|
|
|
|
self.processId = processId
|
|
|
|
|
|
|
|
def __call__(self):
|
|
|
|
pykd.killProcess( self.processId )
|
|
|
|
pykd.detachProcess( self.processId )
|
|
|
|
|
2013-05-01 20:50:44 +08:00
|
|
|
def infGo():
|
|
|
|
"""Infinite pykd.go call"""
|
|
|
|
while True:
|
|
|
|
pykd.go()
|
|
|
|
|