我正在尝试编译带有Python支持的gdb,以便我可以使用提供在以下网址中的PrettyPrinters:
http://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
我从(http://ftp.gnu.org/gnu/gdb/gdb-7.6.1.tar.gz)下载了最新的gdb源代码,并在我的Centos 6.4上进行了如下编译:
1. ./configure --with-python
2. make
我需要为--with-python提供路径或其他参数来指定Python库或可执行文件的路径吗?
在编译后当我运行gdb时,我看到这个警告:
现在当我启动gdb时,出现以下错误:
有人能帮我解决这个问题吗?
在编译后当我运行gdb时,我看到这个警告:
Python Exception <type 'exceptions.ImportError'> No module named 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.
这里很明显出现了异常,无论接下来我将要做什么都会失败,因为它需要gdb模块,但是我还是尝试了一下。所以我在~/.gdbinit中添加了以下几行:
import sys
sys.path.insert(0, '/tmp/pretty/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
现在当我启动gdb时,出现以下错误:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/tmp/pretty/python/libstdcxx/v6/printers.py", line 18, in <module>
import gdb
ImportError: No module named gdb
Error while executing Python code.
有人能帮我解决这个问题吗?