GDB printing STL data
Question: After following the instructions given on this site:
<https://sourceware.org/gdb/wiki/STLSupport> GDB is still unable to print the
contents of stl containers like vectors, other than printing out a huge amount
of useless information. When GDB loads, I also get the following errors, which
I think are related to the Python that I put into `~/.gdbinit`

    
    
    Traceback (most recent call last):
      File "<string>", line 4, in <module>
      File "/Users/mayankp/gdb_printers/python/libstdcxx/v6/printers.py", line 1247, in register_libstdcxx_printers
        gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
      File "/usr/local/share/gdb/python/gdb/printing.py", line 146, in register_pretty_printer
        printer.name)
    RuntimeError: pretty-printer already registered: libstdc++-v6
    /Users/mayankp/.gdbinit:6: Error in sourced command file:
    Error while executing Python code.
    


Answer: > When GDB loads, I also get the following errors...

It looks like instructions you followed on
<https://sourceware.org/gdb/wiki/STLSupport> are invalid now. If you look at
`svn log` you will see that registering of pretty printers was added in
`__init__.py` recently:

    
    
    ------------------------------------------------------------------------
    r215726 | redi | 2014-09-30 18:33:27 +0300 (Вт., 30 сент. 2014) | 4 lines
    
    2014-09-30  Siva Chandra Reddy  <sivachandra@google.com>
    
            * python/hook.in: Only import libstdcxx.v6.
            * python/libstdcxx/v6/__init__.py: Load printers and xmethods.
    ------------------------------------------------------------------------
    

And therefore second registration throws error. You can remove it or comment
out:

    
    
    #register_libstdcxx_printers (None)
    

> GDB is still unable to print the contents of stl containers

You have probably mismatched pretty printers with your gcc. See
<http://stackoverflow.com/a/9108404/72178> for details.

