diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2010-10-08 11:31:56 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2010-10-08 12:31:56 +0100 |
commit | 708f539dd1eb7c8498b79b95746c717684559b38 (patch) | |
tree | 04c02ea6ce247ef1526b3adba1a34edfcc8fd0a7 /libstdc++-v3/python | |
parent | 105b5e659ac30ffadc5d08448c1f2efccdf80148 (diff) | |
download | gcc-708f539dd1eb7c8498b79b95746c717684559b38.zip gcc-708f539dd1eb7c8498b79b95746c717684559b38.tar.gz gcc-708f539dd1eb7c8498b79b95746c717684559b38.tar.bz2 |
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
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r-- | libstdc++-v3/python/libstdcxx/v6/printers.py | 4 |
1 files changed, 3 insertions, 1 deletions
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' |