From 708f539dd1eb7c8498b79b95746c717684559b38 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 8 Oct 2010 11:31:56 +0000 Subject: 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 --- libstdc++-v3/python/libstdcxx/v6/printers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libstdc++-v3/python') diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 5333c57..bf3689b 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' -- cgit v1.1