PDiracDelta
PDiracDelta

Reputation: 2558

how to debug cython using cygdb?

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:

  1. 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 to python2 ... so how does that work?)
  2. is incomplete (some steps covered in code blocks, others vaguely referred to in text)
  3. is inconsistent (e.g. references to both source.pyx and myfile.pyx)

Furthermore, it:

  1. does not take the use of virtual environments into account
  2. seems to assume the main function resides in the .pyx (but mine resides in a regular main.py)
  3. does not specify what to do when your files live in different directories (e.g. like my main.py and cythonCode.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.

Upvotes: 11

Views: 1109

Answers (0)

Related Questions