Unconstant Conjunction latest posts

Setting up GDB for Debugging Python on OS X

Note: this post can be read as a series of terminal commands if you’re not interested in the intervening explanations.

Recently, I started writing a Python extension that wraps the procedural generation library libnoise using SIP-generated code, and encountered the inevitable segfaults. It didn’t take long to establish that the error was somewhere in my C++ code, but I couldn’t figure out where exactly it was. A couple of searches online revealed that the way to go about finding these things was to use a proper debugger, and because the GNU Debugger – `gdb – supports Python, that seemed to be the way to go.

Getting it working was not, however, particularly straightforward. gdb supports debugging Python code as of version 7. Unfortunately, Apple’s version of gdb is currently sitting at 6.3. So all I had to do was get a newer version, right? Wrong.

Continue Reading →

Building Libnoise on OS X

    29 September 2013 // tagged

Although it is very old (and unmaintained since 2007), Libnoise is a great library for procedural generation of pseudorandom noise. It provides a wonderfully intuitive way of chaining together various layers and styles of noise that I’ve never seen matched, even in newer implementations. It also supports seeds (which I require), and is largely feature-complete. I’ve used some of the Java and XNA ports in the past, but in the last few days started getting interested in using the original C++ code, partly because I’m wondering if it can be converted into a Python extension.

Continue Reading →