Locking up on hitting breakpoint?

Jun 24, 2014 at 10:21 PM
I run this (with a real address in it) from a file using the !py command in windbg and it sets the bp, but when it hits, windbg says "Exception in debugger client" and locks up. What am I doing wrong? I'm using x64 windbg and downloaded and installed pykd-0.2.0.29-x64-python-2.7
import pykd

def hitBp(ID):      
        
    print("hats")

    return pykd.NoChange

pykd.setBp(address, hitBp)
Jun 25, 2014 at 6:43 AM
It is a bug in pykd. But your script will not work. It set breakpoint and then python interpreter goes out, python objects are destroyed.

You should change it:
import pykd

def hitBp(ID):      
        
    print("hats")

    return pykd.NoChange

pykd.setBp(address, hitBp)

pykd.go() # script will wait for target is break
You can upgrade pykd version to 0.3.0.7. It has additional argument for command !py:
!py -g script
This script will be run with "global" python enviroment - lifetime of global python objects is equal to lifetime of pykd module