I set up gdb libstdc++ pretty-printers as described in GDB Wiki. But pretty printing didn't work, gdb kept printing raw data.
I changed printers.py to fix it:
--- python/libstdcxx/v6/printers.py.old 2018-10-13 13:57:11.000000000 +0300
+++ python/libstdcxx/v6/printers.py 2018-10-13 14:35:55.000000000 +0300
@@ -1306,2 +1306,4 @@
def add(self, name, function):
+ if (name.startswith('std::')):
+ self.add(name[5:], function)
# A small sanity check.
The patch makes Printer handle std::xxx and xxx equally (e.g. std::vector and vector). The patch helped!
Why did it help? Where is the bug? Used gdb 8.0.1, gcc 8.2.0 installed via macports.
This is a known issue on OS X but I'm unable to debug it myself, as I don't use OS X.
The problem seems to be related to the debug info that GCC outputs into OS X binaries. On OS X the types shown in the debug info do not match what the pretty printers expect.