[v3] libstdc++/45403 support gdb 7.0 in std::string pretty printer

Jonathan Wakely jwakely.gcc@gmail.com
Fri Oct 8 11:32:00 GMT 2010


Tested with GNU gdb (GDB) Fedora (7.1-34.fc13)

Committed to trunk.

        PR libstdc++/45403
        * python/libstdcxx/v6/printers.py: Check for lazy_string support.


Index: python/libstdcxx/v6/printers.py
===================================================================
--- python/libstdcxx/v6/printers.py     (revision 165162)
+++ python/libstdcxx/v6/printers.py     (working copy)
@@ -580,7 +580,9 @@ class StdStringPrinter:
         reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
         header = ptr.cast(reptype) - 1
         len = header.dereference ()['_M_length']
-        return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
+        if hasattr(ptr, "lazy_string"):
+            return ptr.lazy_string (length = len)
+        return ptr.string (length = len)

     def display_hint (self):
         return 'string'



More information about the Libstdc++ mailing list