[PATCH] libstdc++:: improve how pretty printers find node types (PR 91997)
François Dumont
frs.dumont@gmail.com
Tue Dec 3 05:59:00 GMT 2019
On 11/29/19 3:46 PM, Jonathan Wakely wrote:
> This fixes two related problems.
>
> The iterators for node-based containers use nested typedefs such as
> std::list<T>::iterator::_Node to denote their node types. As reported in
> https://bugzilla.redhat.com/show_bug.cgi?id=1053438 those typedefs are
> not always present in the debug info. That means the pretty printers
> cannot find them using gdb.lookup_type (via the find_type helper).
> Instead of looking up the nested typedefs this patch makes the printers
> look up the actual class templates directly.
>
> A related problem (and the original topic of PR 91997) is that GDB fails
> to find types via gdb.lookup_type when printing a backtrace from a
> non-C++ functiion: https://sourceware.org/bugzilla/show_bug.cgi?id=25234
> That is also solved by not looking up the nested typedef.
>
> Â Â Â Â PR libstdc++/91997
> Â Â Â Â * python/libstdcxx/v6/printers.py (find_type): Fail more gracefully
> Â Â Â Â if we run out of base classes to look at.
> Â Â Â Â (llokup_templ_spec, lookup_node_type): New utilities to find node
Small typo here for the 'lookup'.
> Â Â Â Â types for node-based containers.
> Â Â Â Â (StdListPrinter.children, NodeIteratorPrinter.__init__)
> Â Â Â Â (NodeIteratorPrinter.to_string, StdSlistPrinter.children)
> Â Â Â Â (StdSlistIteratorPrinter.to_string,
> StdRbtreeIteratorPrinter.__init__)
> Â Â Â Â (StdMapPrinter.children, StdSetPrinter.children)
> Â Â Â Â (StdForwardListPrinter.children): Use lookup_node_type instead of
> Â Â Â Â find_type.
> Â Â Â Â (StdListIteratorPrinter.__init__,
> StdFwdListIteratorPrinter.__init__):
> Â Â Â Â Pass name of node type to NodeIteratorPrinter constructor.
> Â Â Â Â (Tr1HashtableIterator.__init__): Rename argument.
> Â Â Â Â (StdHashtableIterator.__init__): Likewise. Use lookup_templ_spec
> Â Â Â Â instead of find_type.
> Â Â Â Â * testsuite/libstdc++-prettyprinters/59161.cc: Remove workaround for
> Â Â Â Â _Node typedef not being present in debuginfo.
> Â Â Â Â * testsuite/libstdc++-prettyprinters/91997.cc: New test.
>
> Tested powerpc64le-linux, committed to trunk.
>
> I plan to backport this to the release branches too.
>
More information about the Libstdc++
mailing list