This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Make iterator printers fail more gracefully


On 15 December 2016 at 19:39, Jonathan Wakely <jwakely@redhat.com> wrote:
> This patch tries to improve the user experience when debugging
> container iterators, for cases where some of the typedefs used by the
> printers are not in the debuginfo, so gdb.lookup_type() calls fail.
> That happens if the iterator's operator*() and operator->() haven't
> been instantiated, or if they've been inlined.
>
> Currently this results in an exception:
>
> $1 = Python Exception <class 'ValueError'> Cannot find type
> std::_List_iterator<int>::_Node:
> If the iterator being printed is part of some other object the whole
> thing fails due to the exception.
>
> With this patch the iterator instead prints:
>
> $1 = <insufficient debuginfo for std::list iterator>
>
> and if it's a subobject the rest of the object is printed, with that
> as the value of the iterator.
>
>         * python/libstdcxx/v6/printers.py
> (StdListIteratorPrinter.to_string):
>         Handle exception from failed type lookup and return user-friendly
>         string.
>         (StdRbtreeIteratorPrinter.__init__): Handle exception from failed
>         type lookup.
>         (StdRbtreeIteratorPrinter.to_string): Return user-friendly string.
>
> Seem reasonable?

Yes, looks like a good improvement.

> I consider this a stop-gap until we have Xmethods for all our iterator
> types, then we'll be able to "print *iter" even without debuginfo for
> all the iterator's members, and we can disable these printers.


+1.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]