aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-01-09 21:46:13 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-01-09 21:46:13 +0000
commit8273aa77d4e122fd036b1555b1a6f2496887e481 (patch)
treebc03ad244623172d08b5c2628d2d373fd440eb55 /libstdc++-v3/python
parentee6019ce5d3bc7e80ab1d8b8d2fbad3351ff778b (diff)
downloadgcc-8273aa77d4e122fd036b1555b1a6f2496887e481.zip
gcc-8273aa77d4e122fd036b1555b1a6f2496887e481.tar.gz
gcc-8273aa77d4e122fd036b1555b1a6f2496887e481.tar.bz2
PR libstdc++/80276 fix pretty printers for array smart pointers
PR libstdc++/80276 * python/libstdcxx/v6/printers.py (SharedPointerPrinter) (UniquePointerPrinter): Print correct template argument, not type of the pointer. (TemplateTypePrinter._recognizer.recognize): Handle failure to lookup a type. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test unique_ptr of array type. * testsuite/libstdc++-prettyprinters/cxx17.cc: Test shared_ptr and weak_ptr of array types. From-SVN: r256400
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index e9f7359..d6de096 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -150,7 +150,7 @@ class SharedPointerPrinter:
state = 'expired, weak count %d' % weakcount
else:
state = 'use count %d, weak count %d' % (usecount, weakcount - 1)
- return '%s<%s> (%s)' % (self.typename, str(self.pointer.type.target().strip_typedefs()), state)
+ return '%s<%s> (%s)' % (self.typename, str(self.val.type.template_argument(0)), state)
class UniquePointerPrinter:
"Print a unique_ptr"
@@ -169,7 +169,7 @@ class UniquePointerPrinter:
return SmartPtrIterator(self.pointer)
def to_string (self):
- return ('std::unique_ptr<%s>' % (str(self.pointer.type.target())))
+ return ('std::unique_ptr<%s>' % (str(self.val.type.template_argument(0))))
def get_value_from_aligned_membuf(buf, valtype):
"""Returns the value held in a __gnu_cxx::__aligned_membuf."""
@@ -1328,9 +1328,13 @@ class TemplateTypePrinter(object):
for i, sub in enumerate(subs):
if ('{%d}' % (i+1)) in self.subst:
# apply recognizers to subgroup
+ try:
+ subtype = gdb.lookup_type(sub)
+ except gdb.error:
+ continue
rep = gdb.types.apply_type_recognizers(
gdb.types.get_type_recognizers(),
- gdb.lookup_type(sub))
+ subtype)
if rep:
subs[i] = rep
subs = [None] + subs