configure
脚本的启动方式如下
./configure --with-python=yes --host=arm-linux-gnueabi
因此,python 已启用。同样在 log of configure script我没有发现任何与 python 相关的问题。但无论如何,编译后的 gdb 一直在说
$ ./gdb -q
/home/constantine/.gdbinit:7: Error in sourced command file:
ind_string_in_backtrace (gdb.Function)::1: Error in sourced command file:
Undefined command: "class". Try "help".
(gdb) py print("hello")
Python scripting is not supported in this copy of GDB.
我进入gdb后你能看到的错误也是关于Python的(自动启动时加载的脚本)。我试过 make clean
,但没有用。我希望有人知道解决方案,我真的需要脚本,因此需要 python。
最佳答案
您的构建机器上可能缺少 python 开发库(Ubuntu 上的 python-dev 包或变体,CentOS 上的 python-devel)。
在配置 gdb 时,在 gdb 的顶级配置日志中没有提到 python。
尝试像这样构建:
make 1> out.log 2> err.log然后在out.log中搜索python。您应该会看到类似这样的内容,才能开始使用 python 脚本。
checking whether to use python... auto checking for python... /usr/bin/python checking for python2.7... yes checking compiler flags for python code... -fno-strict-aliasing -DNDEBUG -fwrapv checking whether python supports threads... yes
关于python - 如何修复“此 GDB 副本不支持 Python 脚本”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25929037/