Author: Kristján Valur Jónsson (kristjan.jonsson) *
Date: 2010-11-03 08:20
import ctypes ctypes.windll.kernel32.DebugBreak() This used to be a handy way to attach a debugger to a running program, by way of JIT debugging. Now ctypes catches and handles this exception so a debugger is never invoked. Bummer.
With a release build of python, I have a similar behavior on both 2.5 and 2.7; the messages are different though: 2.5: WindowsError: [Error -2147483645] One or more arguments are invalid. 2.7: WindowsError: exception: breakpoint encountered And with both versions, a debug build (python_d.exe) triggers the JIT debugger. What do you get exactly?
Author: Kristján Valur Jónsson (kristjan.jonsson) *
Date: 2010-12-27 02:42
I _think_ that in our old 2.5 python (which had a backported ctypes from 2.6 to support 64 bits) we always got the JIT debugger i.e. with _ctypes.pyd and _ctypes_d.pyd. This api, "DebugBreak" always invokes the JIT debugger, however the program was compiled (_NDEBUG, DEBUG, or not). This is done by raising the breakpoint exception and apparently _ctypes.pyd is catching that exception and handling it, but only in release mode, while I think it shouldn't do.