Quantcast
Channel: Python extension for WinDbg
Viewing all articles
Browse latest Browse all 1625

New Post: pykd in multiprocessing

$
0
0
Hi, I did some tests for pykd 0.3.0.4.

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.

Viewing all articles
Browse latest Browse all 1625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>