Hi, I did some tests for pykd 0.3.0.4.
this is my test code and it works:
I always need to trace many created dynamically processes.
Thanks.
this is my test code and it works:
#!/usr/bin/env python
# -*- coding: utf-8 -*
# author: SAI
import os,sys,time,traceback
import pykd
def getCurrentProcessId():
return pykd.getProcessSystemID()#return target processid in my machine
return pykd.getProcessIdBySystemID(pykd.getProcessSystemID()) #return unique id
class ExceptionHandler(pykd.eventHandler):
def onException(self, exp):
print exp,getCurrentProcessId()
print '-'*10
g_allid={}
def monitor():
handler=ExceptionHandler()
try:
while 1:
pykd.go()
except Exception, err:
print traceback.format_exc()
print err,'over' #program over but no exception
def test_thread():
pykd.initialize()
for name in ['test.exe','test.exe']:
id=pykd.startProcess(name) #pykd.attachProcess(xxxpid)
g_allid[id]=name
monitor()
import threading
def main():
th=threading.Thread(target=test_thread)
th.start()
if __name__=='__main__':
main()
but how can I launch(or attach) another process after main function?I always need to trace many created dynamically processes.
Thanks.