PageRenderTime 88ms CodeModel.GetById 83ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/pygdb2/test/set_watchpoint.py

https://bitbucket.org/antocuni/pygdb2/
Python | 20 lines | 17 code | 3 blank | 0 comment | 3 complexity | fd5e52662fef16c871732a0dccadd388 MD5 | raw file
 1import ctypes
 2import pygdb2
 3
 4def main():
 5    print 'program starting'
 6    buf = ctypes.c_int()
 7    buf.value = 42
 8    adr = ctypes.cast(ctypes.pointer(buf), ctypes.c_void_p)
 9    pygdb2.execute("watch *(int*)%d" % adr.value) # enter gdb when we write to this memory
10
11    i = 0
12    while i < 5:
13        print i
14        i += 1
15        if i == 2:
16            buf.value = 43 # we should enter gdb here
17    print 'program stopping'
18
19if __name__ == '__main__':
20    main()