libstdc++: Fix filesystem::path pretty printer test failure
authorJonathan Wakely <jwakely@redhat.com>
Wed, 2 Dec 2020 00:39:21 +0000 (00:39 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 2 Dec 2020 00:39:21 +0000 (00:39 +0000)
commita70384f94c83895f97179b45c1a8d66202132af8
treea54809f7f4a1cbb59e9c7cf39acd4a134e076570
parent54967b02c192f893e0f23481c865dd8abcb74018
libstdc++: Fix filesystem::path pretty printer test failure

On some systems libstdc++-prettyprinters/cxx17.cc FAILs with this error:

skipping: Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name': ^M
got: $27 = filesystem::path "/dir/."^M
FAIL: libstdc++-prettyprinters/cxx17.cc print path2

The gdb.Type.name attribute isn't present in GDB 7.6, so we get an
exception from StdPathPrinter._iterator.__next__ trying to use it.
The StdPathPrinter._iterator is already passed the type's name in its
constructor, so we can just store that and use it instead of
gdb.Type.name.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (StdExpPathPrinter): Store the
name of the type and pass it to the iterator.
(StdPathPrinter): Likewise.
* testsuite/libstdc++-prettyprinters/filesystem-ts.cc: New test.
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/libstdc++-prettyprinters/filesystem-ts.cc [new file with mode: 0644]