This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] libstdc++/45403 support gdb 7.0 in std::string pretty printer
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Oct 2010 12:31:58 +0100
- Subject: [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'