This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to debug Python code

+1 vote

Hi,
I would like to ask how exactly to debug my code. I would like to know if I could debug or access C++ routines from Python code and if I can somehow figure out which C++ code is exactly executed when calling Python wrappers.

Thank you,
Vojtech.

asked May 26, 2014 by kulvv1am FEniCS Novice (270 points)
edited May 26, 2014 by kulvv1am

1 Answer

+1 vote

You may use gdb to debug your code.
gdb python
(gdb) run
which gives you the python shell within gdb
or
(gdb) run some_script
to run a script.

You may use ddd to run gdb and python in separate threads.
See page 381 in the fenics-book.

That said, debugging mixed language applications is harder than
single language applications.

answered May 26, 2014 by Kent-Andre Mardal FEniCS Expert (14,380 points)
...