无法在我的 python C 扩展上启动 dbg

Cannot start dbg on my python C extension

我正在使用 python3.6.1 安装在 pyenv 中。我的代码中 运行ning gdb 有问题。当我 运行 gdb --args python mycode.py 它以错误 "/home/vydra/.pyenv/shims/python": not in executable format: File format not recognized

结束

正如 Jean-François Fabre 所说,pyenv 安装的 python 文件实际上是一个 bash 脚本。您可以使用以下命令轻松制作 gdb 运行 这个脚本:

gdb -ex r --args bash python mycode.py

有关其他方法,请参阅此问题:Use GDB to debug a C++ program called from a shell script