On 06/03/2018 22:21, Jonathan Wakely wrote:


@@ -575,10 +586,12 @@ class StdDebugIteratorPrinter:
     # and return the wrapped iterator value.
     def to_string (self):
         base_type = gdb.lookup_type('__gnu_debug::_Safe_iterator_base')
+        itype = self.val.type.template_argument(0)
         safe_seq = self.val.cast(base_type)['_M_sequence']
-        if not safe_seq or self.val['_M_version'] != safe_seq['_M_version']:
+        if not safe_seq:
+            return str(self.val.cast(itype))
So what's the effect of this change when we get a value-initialized
debug iterator? It prints the wrapped (value-initialized) non-debug
iterator instead?

Yes, for instance this test in smiple11.cc:


  std::deque<int>::iterator deqiter0;
// { dg-final { note-test deqiter0 {non-dereferenceable iterator for std::deque} } }

    Was failing when running 'make check-debug RUNTESTFLAGS=prettyprinters.exp' because it was displaying 'invalid iterator' rather than non-dereferenceable. Now it is succeeded.

François

Reply via email to