Chapter 4. Debugging Cython
Since Cython programs compile down to their native code, we cannot use the Python debugger to step through your code. We can, however, use GDB. GNU Project Debugger (GDB) is a cross platform debugger. Python plugin support was added in version 7.0, which was used to add the Cython support into gdb
as a simple script; this means that you can seamlessly step through the C/C++ code into Cython and back again.
When it comes to language binding, it's good practice to keep interfaces as simple as possible. This will make debugging much simpler until you are happy with your bindings in terms of resource management or stability. I will iterate over some GDB and caveats examples.
In this chapter, we will cover the following topics:
- Using GFB with Cython
- Cython caveats