python - 如何修复“此 GDB 副本不支持 Python 脚本”

标签 python configuration gdb

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/

相关文章:

configuration - 为什么 Hadoop 中正确的 reduce 数量是 0.95 或 1.75?

python - Esky更新导致事务处理文件操作错误

python - 与 Pandas 左侧数据框中的覆盖值合并

python - Pyramid 配置加载错误

Eclipse:无论正在编辑哪个文件,我怎样才能使 Ctrl+F11 工作?

gdb - 让 gdb 在断点处退出

Python - 如果字典中的值那么

Python将包含十六进制的字符串转换为实际的十六进制

c++ - 使用 GDB 调试英特尔编译项目

gdb - 软件中断异常还是未定义指令异常?