我正在尝试使用gdb调试一些Cython代码,该代码包装了要从Python调用的C ++代码。我遵循了documentation中的说明,但是在调试时遇到了一些与代码无关的错误。示例:
(gdb) cy print some_variable
Python Exception <type 'exceptions.AttributeError'> 'PyDictObjectPtr' object has no attribute 'items':
Error occurred in Python: 'PyDictObjectPtr' object has no attribute 'items'
有时我也会得到这个(通常在第一个之后):
Python Exception <class 'gdb.error'> There is no member named ob_sval.:
Error occurred in Python command: There is no member named ob_sval.
要调试代码,我使用Docker创建了一个环境:
FROM debian
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
build-essential gdb-python2 python-dbg python-dev \
python-pip python-numpy-dbg
RUN pip install cython pygments
CMD bash
答案 0 :(得分:2)