This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Make iterator printers fail more gracefully
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 15 Dec 2016 19:46:17 +0200
- Subject: Re: RFC: Make iterator printers fail more gracefully
- Authentication-results: sourceware.org; auth=none
- References: <20161215173917.GA12231@redhat.com>
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.