Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Python with compiled extensions [closed]

I use Python with compiled Cython and Fortran extensions (wrapped using modern Fortran's iso_c_binding module and Cython) for number crunching.

So far, I do not have a convenient debugging strategy. I use pudb for the Python part. Although I might be able to use gdb on the Cython&Fortran parts of the project, I find myself to be using console text output (print()!) instead.

I'd like to know if there are tools that make the different levels of code transparent for debugging, i.e. I'm looking for a "one-tool-debugs-it-all" solution that doesn't care whether it steps Python, Cython or Fortran code.

I'd prefer tools that allow user-friendly interaction, such as the aforementioned pudb. Does such a jack of all trades debugging tool exist? Is the Python mode of GDB the best I can get?

like image 348
AlexE Avatar asked Apr 22 '13 10:04

AlexE


2 Answers

You can use the Cython debugger which extends gdb with new commands that begin cy. These let you step through Cython code, set breakpoints, inspect locals etc. and still work just like the py commands from GDB's Python mode when you happen to be in a Python frame. There's no Fortran support unfortunately.

like image 199
r3m0t Avatar answered Nov 02 '22 14:11

r3m0t


You can try free PTVS + trial Intel Fortran + mixed mode debugging

see also

http://pytools.codeplex.com/wikipage?title=Mixed-mode%20debugging http://pytools.codeplex.com/workitem/1974

like image 1
denfromufa Avatar answered Nov 02 '22 12:11

denfromufa