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
This commit is contained in:
Jonathan Wakely 2010-10-08 11:31:56 +00:00 committed by Jonathan Wakely
parent 105b5e659a
commit 708f539dd1
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-10-08 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/45403
* python/libstdcxx/v6/printers.py: Check for lazy_string support.
2010-10-08 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/future (uses_allocator<packaged_task<>,>): Add;

View File

@ -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'