This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]