gdb reports ImportError no module libstdcxx.v6.printers

Bug #921839 reported by Jeffrey Thompson
58
This bug affects 12 people
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

GDB attempts to use a python "pretty printer" and reports the following error:

[Thread debugging using libthread_db enabled]
Traceback (most recent call last):
  File "/usr/local/lib64/libstdc++.so.6.0.16-gdb.py", line 59, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
[Inferior 1 (process 31059) exited normally]
(gdb)

GDB Version: GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08

I found that by doing the following it fixes the problem:

svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python gdb_printers
mv gdb_printers /usr/local/etc
cd ~
vi .gdbinit

(copy & paste into .gdbinit)

python
import sys
sys.path.insert(0, '/usr/local/etc/gdb_printers')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gdb (Ubuntu):
status: New → Confirmed
Revision history for this message
Martin Scherer (marscher) wrote :

This bug also affects gdb in precise.

Revision history for this message
Matthias Klose (doko) wrote :

 the traceback references a file in /usr/local, installed by the user. again, this works with the system provided libstdcxx.v6.printers

Changed in gdb (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
SRombauts (sebastien-rombauts) wrote :

Bug #908163 says that this as been fixed for /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16-gdb.py

but

Bug #952999 says that there is the same kind issue for /usr/lib/debug/usr/lib/i386-linux-gnu/libstdc++.so.6.0.16-gdb.py

Revision history for this message
SpencerL (youngth) wrote :

Hello guys! I met the similar problem . When run gdb ,it shows like that:

Traceback (most recent call last):

File "<string>",line 3, in <module>

File "/root/.gdb/python/libstdcxx/v6/_init_.py",line 19,in <module>

    from printers import register_libstdcxx_printers

ImportError: No module named 'printers'

/root/.gdbinit:4007:Error in sourced command file:

Error while executing Python code.

And I just update with the repository

 ppa:ubuntu-toolchain-r/test

as what you said, It still didn't work.

Any suggestions ? Thank you all

Revision history for this message
Anshu Prateek (anshu-prateek) wrote :

Same problem in trusty as well :!

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[New Thread 0x7fffede9c700 (LWP 63774)]
[New Thread 0x7fffed69b700 (LWP 63775)]
[New Thread 0x7fffece9a700 (LWP 63776)]
[Thread 0x7fffece9a700 (LWP 63776) exited]
[Thread 0x7fffede9c700 (LWP 63774) exited]
[Thread 0x7fffed69b700 (LWP 63775) exited]
[Inferior 1 (process 63741) exited normally]

Revision history for this message
Lauro Moura (lauromoura) wrote :

Had the same problem with gdb 7.7.1 on 14.04 LTS.

Revision history for this message
Greg Whiteley (greg-whiteley) wrote :

See comment 14 on #952999 for a workaround edit

https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/c/comments/14

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.