Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem with GDB. Whenever I try to debug any C++ program, just after running it, GDB gives this error:

(gdb) run
Starting program: /home/errikos/Workspaces/tests/a.out 
Traceback (most recent call last):
  File "/usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18-gdb.py", line 59, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
Traceback (most recent call last):
  File "/usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18-gdb.py", line 59, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers

After that, GDB continues running (ie. does not crash completely).

I am aware that there are several bug reports about this (here, here and here). In the second report, there is also a claim that there is a fix released. In the third one, there is a symlink workaround, that did not work for me (and which I do not like, even if it worked).

Has anyone found a workaround for this? Any missing package?

Note: I have the Ubuntu Toolchain test builds (ppa:ubuntu-toolchain-r/test) PPA activated.

share|improve this question
add comment

1 Answer 1

This is a bug in /usr/lib/debug/usr/lib/$triple/libstdc++.so.6.0.18-gdb.py; if it were operating correctly, you would only see the ImportError once, and the pretty-printers would work.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701935#18 for some information about what's going wrong here. This worked okay in Debian's gcc-4.7, but until recently did not work in gcc-4.8 on Debian. I'm not sure if I even tried this with gcc-4.6.

Regardless, you can patch that file to look in the right place.

share|improve this answer
    
Could you provide a sample patch? –  InkBlend Nov 27 '13 at 6:14
    
This has been probably fixed by the latest packages in ppa:ubuntu-toolchain-r/test, as I do not get this error anymore. I had lost interest in this as I have not been doing much C/C++ development lately. Thanks for your answer though! –  errikos Nov 27 '13 at 9:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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