It is supposedly possible to debug a Python3/Cython project using gdb, after building gdb from source if you configure it with python2.7 as specified in the Cython debugging documentation.
However, the example in the documentation:
- is sometimes vague (e.g. the code should be built with python3 and debugger run with python2, but I discovered
python-gdb
is actually linked topython2
... so how does that work?) - is incomplete (some steps covered in code blocks, others vaguely referred to in text)
- is inconsistent (e.g. references to both
source.pyx
andmyfile.pyx
)
Furthermore, it:
- does not take the use of virtual environments into account
- seems to assume the
main
function resides in the .pyx (but mine resides in a regularmain.py
) - does not specify what to do when your files live in different directories (e.g. like my
main.py
andcythonCode.pyx
do)
Could someone please explain (preferably with working example) how to do debug a Python3/Cython project in a situation involving all 3 points just mentioned?
At the moment it seems I can actually get DDD to work following this Cython wiki article, but I then discovered that is the 'old' way of doing it, and it refers to the current debugging documentation I also linked to. At this point however, it is unclear to me how the 'new' method functions (the old makes more sense to me) and it surely seems more complex to get it to work.