https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59171

--- Comment #8 from Michael Teske <subscribe at teskor dot de> ---
As a proof of concept I could come up with a printer for reverse_iterator that
works on lists. Not very elegant, and this would need to be implemented for all
the other containers, too (because we cannot use operator-- when debugging a
core dump). 
Don't know if it's worth the hassle, but as a starting point, here it is:

class reverseprinter(object):
    "print a reverse_iterator. works only for list"
    def __init__(self, typname, val):
        self._val = val

    def to_string(self):
        # save the type of iterator, so we can use its prettyprinter
        current_type = self._val['current'].type
        # this works for list only:
        return self._val['current']['_M_node']['_M_prev'].cast(current_type)

    def display_hint(self):
        return 'string'


and in register_libstdcxx_printers add:
       libstdcxx_printer.add_container('std::', 'reverse_iterator',
                                        reverseprinter)

Reply via email to