3

I am trying to debug Cython code that wraps a c++ class, and the error I am hunting is somewhere in the C++ code.

It would be awfully convenient if I could somehow debug as if it were written in one language, i.e. if there's an error in the C++ part, it would show me the source code line there, and if the error is in the Python part it would do the same.

Right now I always have to try and replicate the Python code using the class in C++, and right now I have an error that only occurs when running through Python ... I hope somebody can help me out :)

akaihola
  • 26,309
  • 7
  • 59
  • 69
fbence
  • 2,025
  • 2
  • 19
  • 42

1 Answers1

4

It's been a while for me and I forgot how I exactly did it, but when I was writing my own C/C++ library and interfaced it with swig into python, I was able to debug the C code with DDD. It was important to compile with debug options. It wasn't great, but it worked for me. I think you had to run ddd python and within the python terminal run my faulty C code. You would have to make sure all linked libraries including yours is loaded with the source code so that you could set breakpoints.

El Dude
  • 5,328
  • 11
  • 54
  • 101
  • I'll give this a try, thanks! This DDD seems less appealing than say doing the same in pycharm, but one shouldn't be too picky :) – fbence Oct 07 '16 at 12:37
  • No, DDD is by far not user friendly and has many downsides, but it's the default frontend for the GNU debugger gdb so that compatibility is at least ensured. Good luck. – El Dude Oct 07 '16 at 16:09