首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python异常<type‘Exctions.ImportError’>没有名为gdb的模块:

python异常<type‘Exctions.ImportError’>没有名为gdb的模块:
EN

Stack Overflow用户
提问于 2014-09-01 00:15:11
回答 4查看 23K关注 0票数 12

我刚刚从运行linux的服务器机器上的主目录中的源代码编译了gdb 7.8。我以前一直在使用gdb 7.6,除了gdb本身的稳定性问题(升级的原因)之外,一切都很好。

自从gdb升级之后,当我运行cgdb 0.6.7时,我立即收到以下消息:

Python异常没有模块名为gdb:警告:无法从‘/home/username/bin/ gdb // Python’加载python模块。_gdb模块提供了有限的Python支持。建议将--data-目录=/path/to/gdb/data-目录。

当我构建gdb时,我使用了./configure --with-python

当我运行cgdb并且我的程序出现分段错误时,我输入backtrace并得到以下消息:

Python没有名为gdb.frames的模块:

因此,如果没有python支持,我似乎实际上无法使用gdb/cgdb。我能做些什么来解决这个问题?

我不使用python,我通常写c++

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2014-09-01 08:21:56

您应该指定"--data-directory“的值。例如,如果您从build目录加载gdb,那么命令应该是:

代码语言:javascript
复制
./gdb -data-directory ./data-directory

然后gdb可以知道在哪里可以找到python模块。

您可以参考这个discussion

票数 18
EN

Stack Overflow用户

发布于 2018-05-05 08:29:08

代码语言:javascript
复制
root@labs:~/gdb-8.1# gdb --version
Python Exception <type 'exceptions.ImportError'> No module named gdb: 
gdb: warning: 
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
....

尝试将python转换为--data-directory=/path/to/gdb/data-directory.我的数据目录是/usr/local/share/gdb/python

代码语言:javascript
复制
# mkdir -p /usr/local/share/gdb/python/gdb
# cp -rf ~/gdb-8.1/gdb/python/lib/gdb/* /usr/local/share/gdb/python/gdb/


# gdb --version
GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
票数 5
EN

Stack Overflow用户

发布于 2018-12-18 16:09:58

我刚碰到这个,想和大家分享我的发现。在编译过程中,特别是在“message”步骤中,我注意到以下消息:

代码语言:javascript
复制
WARNING: `makeinfo' is missing on your system.  You should only need it if
         you modified a `.texi' or `.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy `make' (AIX,
         DU, IRIX).  You might want to install the `Texinfo' package or
         the `GNU make' package.  Grab either from any GNU archive site.

听起来好像我没有makeinfo是可以的,但实际上它导致了OP询问的错误。在安装texinfo之后,我重新运行make install并运行gdb,没有任何python错误消息。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25597445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档