Debuggers are complicated, especially ones that attach to compiled executables. In Python
pdb runs inside the interpreter, so it does not need to control other processes, but this will not work once we have Cython-compiled components (or other C extensions) in our Python programmes. Unfortunately, Cython offers us plenty of opportunities to shoot ourselves in the foot, and it is more likely we will need to debug use-after-free, double-free or other nasty segfault situations.
Cython does come with a debugger, which is more properly a set of Python extensions to
gdb, the GNU debugger. Macs come with
lldb installed and functional, but sadly getting
gdb running is a bit tricky. At the time of writing, I have macOS 10.14 Mojave, the current version of
gdb is 9.2, and Cython is 0.29.14. Further, the Cython extensions require Python 2.7, but I need to be able to debug Python 3 programmes since it’s the only supported version of Python.
As of right now, I do not have a fully working debugger, but hopefully I will update this post after rebuilding
gdb with some minor patches.