Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
733 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...