This patch fixes a bug in the std::tuple printer where, if the value
was passed by reference, the printer was not correctly dereferencing the
value before printing.
Cheers,

Phil


2013-03-21  Phil Muldoon  <pmuld...@redhat.com>

        PR gdb/15195

        * python/libstdcxx/v6/printers.py (StdTuplePrinter): Convert
        referenced value to actual if type is TYPE_CODE_REF.

--

Index: printers.py
===================================================================
--- printers.py (revision 196862)
+++ printers.py (working copy)
@@ -318,7 +318,12 @@
         return self._iterator (self.val)
 
     def to_string (self):
-        if len (self.val.type.fields ()) == 0:
+        type = self.val.type
+        if type.code == gdb.TYPE_CODE_REF:
+            self.val = self.val.referenced_value()
+            type = self.val.type
+
+        if len(type.fields ()) == 0:
             return 'empty %s' % (self.typename)
         return '%s containing' % (self.typename)
 
        

Reply via email to