Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
736 views
in Technique[技术] by (71.8m points)

python exception <type 'exceptions.ImportError'> No module named gdb:

I've just compiled gdb 7.8 from source in my home directory on a server machine running linux. I had previously been using gdb 7.6, and aside from stability issues with gdb itself (the reason for the upgrade) everything worked fine.

Since the upgrade of gdb, when I run cgdb 0.6.7 I immediately get the following message:

Python Exception <type 'exceptions.ImportError'> No module named gdb:

warning:
Could not load the Python gdb module from `/home/username/bin/gdb//python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

When I built gdb, I used ./configure --with-python.

When I run cgdb and my program reaches a segfault, I type backtrace and get the following message:

Python Exception No module named gdb.frames:

So it seems like I am effectively unable to use gdb/cgdb without python support. What can I do to resolve this?

FWIW; I don't use python, I usually write c++.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should specify the value of "--data-directory". For example, if you load gdb from the build directory, the command should be:

./gdb -data-directory ./data-directory

Then gdb can know where to find python module.

You can refer this discussion.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...