From: Jonathan Wakely Date: Fri, 8 Oct 2010 11:31:56 +0000 (+0000) Subject: re PR libstdc++/45403 (python pretty printer for std::string requires GDB 7.1) X-Git-Tag: releases/gcc-4.6.0~3746 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=708f539dd1eb7c8498b79b95746c717684559b38;p=thirdparty%2Fgcc.git re PR libstdc++/45403 (python pretty printer for std::string requires GDB 7.1) PR libstdc++/45403 * python/libstdcxx/v6/printers.py: Check for lazy_string support. From-SVN: r165163 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 532547bf84b6..172eb5b17366 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2010-10-08 Jonathan Wakely + + PR libstdc++/45403 + * python/libstdcxx/v6/printers.py: Check for lazy_string support. + 2010-10-08 Paolo Carlini * include/std/future (uses_allocator,>): Add; diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 5333c57634fa..bf3689bb7076 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -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'