I have debugged C++ codes using gdb in Ubuntu 14.04. When I pass a stl container to the print command, it used to print the contents of the container. But then I upgraded to Ubuntu 16.04 LTS a week back. Now those pretty printers are not working. When I print them I get those raw container output you get when you don't have python printers installed.

This guy also has the same problem.

I have libstdcxx/v6/python.pyon my system. I also have libstdc++.so.6.0.21-gdb.py in the auto-load folder. When I print info pretty-printer in gdb, I get a list of stl printers, so I know they are registered. However, my gdb doesn't print stl::list variable. i have enabled pretty-printer, set print pretty on.

My gcc version is 5.4 and gdb version is 7.11.1.Both were installed along with Ubuntu 16.04. I haven't built them manually. So anything obvious I am missing?


In my case, the ~/.gdbinit file had a line:

sys.path.insert(0, '/usr/share/gcc-4.8/python/')

It turned out that changing it into: (4.8->5)

sys.path.insert(0, '/usr/share/gcc-5/python/')


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.