cpython-2.7gdbcoredumppython-c-api

Debugging a c-extension in python


I run bayesopt with python bindings. So I have a bayesopt.so that I import from python (a C-extension).

When I run it, it core dumps. I want to load this core dump in gdb to see what the issue is. How can I do this? Or get information on it?

I tried to load gdb on it, but of course it asks for a binary which I don't have since it's a .so.


Solution

  • You want to run gdb on python, ie: gdb -ex r --args python myscript.py. There's some helpful tips in the python wiki: https://wiki.python.org/moin/DebuggingWithGdb