I sat down intending to do an hour or so of playing with ctypes for OpenGL... 5 hours ago. I can't really begrudge the time, though, because beyond finding a number of minor problems with ctypes on amd64, I learned something I've been avoiding for a while now; learning how to debug C extensions on Linux. It's actually something I'm going to need for work over the next week or so (as I track down the last few annoying (and core-dumping) bugs in Cinemon 1.0).
Of course, I know how to debug C extensions on Windows, I've even got patches that let Python distutils compile with symbols for a non-debug extension. But on Linux and FreeBSD I've never bothered with the core files... to the point I hadn't even realised that they weren't produced on my dev machine! I figured it would be a PITA, as on Windows, to get the debug symbols built into my extensions, so I never bothered with them.
Turns out distutils on Linux has a handy-dandy -g flag, which adds the debug symbols to the extension you're building. Once you have that, a little reading tells you that from a bash prompt you do:
ulimit -c unlimitedto turn on core file production (likely want to put that in your .bash_profile if you are a developer).
gdb python coregets you into the debugger, where you can do post-mortem debugging of your crashing application. Unfortunately, the process for doing live debugging is rather annoying looking (to the point that I keep thinking "they must be joking" as I read the FAQ on it), but I'm okay with post-mortems for now, it's what I normally do anyway.
Pingbacks are closed.