14

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.

ergysdo
  • 1,039

1 Answers1

7

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.

SamB
  • 252