Reputation: 76
I followed STL Support Tools and find it is not working on my system. I use gnome Ubuntu 14.04. And I tried this:
(gdb) p vct
Python Exception <class 'TypeError'> iter() returned non-iterator of type '_iterator':
$1 = std::vector of length 20, capacity 32
It threw a "TypeError", and only print length and capacity. My g++ and gdb version:
g++ --version
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
gdb --version
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
My .gdbinit:
python
import sys
sys.path.insert(0,'/home/james/bin/gdb_printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
Please help me, thank you very much.
Upvotes: 2
Views: 493
Reputation: 22549
Note that those instructions are really just for folks either in the past (before this stuff was packaged up) or on non-Linux systems. Your typical modern Linux distro will install these debugging scripts in a way that "just works" without any additional configury on your part.
Upvotes: 0
Reputation: 76
git clone https://github.com/Manicqin/gdb_printers__python python
This will solve the problem perfectly.
no TypeError and no python 3 problem.
Upvotes: 0
Reputation: 213754
sys.path.insert(0,'/home/james/bin/gdb_printers/python')
How did you get /home/james/bin/gdb_printers/python
?
Assuming you followed (inaccurate) instructions on the wiki, and did this:
svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
you now have pretty-printers that match the latest libstdc++
sources (aka "trunk"), while your libstdc++
itself is over a year old, and came from gcc-4.8
.
To get correct pretty-printers, you need to get them from a matching gcc branch. I believe the correct command is:
svn co svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch/libstdc++-v3/python
Upvotes: 5