aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-12-15 13:25:22 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2016-12-15 13:25:22 +0000
commit50a8a9413d3a0a485ef5b1886361c2a1c4487433 (patch)
tree89179b409860041c2cc9c9cac49b6ee9a618ed29 /libstdc++-v3/python
parent7224c6a997c32d3b4f7a2a22d27459ca58ee2587 (diff)
downloadgcc-50a8a9413d3a0a485ef5b1886361c2a1c4487433.zip
gcc-50a8a9413d3a0a485ef5b1886361c2a1c4487433.tar.gz
gcc-50a8a9413d3a0a485ef5b1886361c2a1c4487433.tar.bz2
PR59161 make pretty printers always return strings
PR libstdc++/59161 * python/libstdcxx/v6/printers.py (StdListIteratorPrinter.to_string) (StdSlistIteratorPrinter.to_string, StdVectorIteratorPrinter.to_string) (StdRbtreeIteratorPrinter.to_string, StdDequeIteratorPrinter.to_string) (StdDebugIteratorPrinter.to_string): Return string instead of gdb.Value. * testsuite/libstdc++-prettyprinters/59161.cc: New test. From-SVN: r243690
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 9d84b4f..ab3592a 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -203,7 +203,7 @@ class StdListIteratorPrinter:
nodetype = find_type(self.val.type, '_Node')
nodetype = nodetype.strip_typedefs().pointer()
node = self.val['_M_node'].cast(nodetype).dereference()
- return get_value_from_list_node(node)
+ return str(get_value_from_list_node(node))
class StdSlistPrinter:
"Print a __gnu_cxx::slist"
@@ -248,7 +248,7 @@ class StdSlistIteratorPrinter:
def to_string(self):
nodetype = find_type(self.val.type, '_Node')
nodetype = nodetype.strip_typedefs().pointer()
- return self.val['_M_node'].cast(nodetype).dereference()['_M_data']
+ return str(self.val['_M_node'].cast(nodetype).dereference()['_M_data'])
class StdVectorPrinter:
"Print a std::vector"
@@ -333,7 +333,7 @@ class StdVectorIteratorPrinter:
self.val = val
def to_string(self):
- return self.val['_M_current'].dereference()
+ return str(self.val['_M_current'].dereference())
class StdTuplePrinter:
"Print a std::tuple"
@@ -495,7 +495,7 @@ class StdRbtreeIteratorPrinter:
def to_string (self):
node = self.val['_M_node'].cast(self.link_type).dereference()
- return get_value_from_Rb_tree_node(node)
+ return str(get_value_from_Rb_tree_node(node))
class StdDebugIteratorPrinter:
"Print a debug enabled version of an iterator"
@@ -511,7 +511,7 @@ class StdDebugIteratorPrinter:
if not safe_seq or self.val['_M_version'] != safe_seq['_M_version']:
return "invalid iterator"
itype = self.val.type.template_argument(0)
- return self.val.cast(itype)
+ return str(self.val.cast(itype))
def num_elements(num):
"""Return either "1 element" or "N elements" depending on the argument."""
@@ -708,7 +708,7 @@ class StdDequeIteratorPrinter:
self.val = val
def to_string(self):
- return self.val['_M_cur'].dereference()
+ return str(self.val['_M_cur'].dereference())
class StdStringPrinter:
"Print a std::basic_string of some kind"