I am utilizing Cython to invoke a C++ API from python, and I'd like to debug the application.
My setup.py
file is structured as follows:
from distutils.core import setup
from distutils.extension import Extension
from distutils.util import get_platform
from Cython.Build import cythonize
import glob
import os
myplatform = get_platform().split("-")[0]
if myplatform[:3] == 'mac':
compile_args = ["-g", "-std=c++11", "-stdlib=libc++"]
elif myplatform == "linux":
compile_args = ["-g", "-std=c++11"]
else:
raise ValueError("Not using Unix-based OS")
extensions = [
Extension(...,
include_dirs=['/'],
extra_compile_args=compile_args,
extra_link_args=["-g"],
language='c++'
)
]
setup(
name="app name",
ext_modules=cythonize(extensions),
packages=['app_wrapper']
)
I've added the -g
flags in an effort to generate debug symbols. I invoke setup.py
using the following:
python setup.py build_ext --inplace --debug
After building, I invoke gdb to debug:
~/projdir: gdb python
(gdb) run scripts/myscript.py
When I hit the exception I'm trying to debug, I have no symbols:
0x00007ffff0980c28 in ?? ()
(gdb) bt
#0 0x00007ffff0980c28 in ?? ()
#1 0x0000000104c5efa2 in ?? ()
#2 0x0000000000000000 in ?? ()
How do I debug this script?