libstdc++: Add pretty printer for std::stringstreams
authorPhilipp Fent <fent@in.tum.de>
Tue, 6 Sep 2022 21:24:29 +0000 (23:24 +0200)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 14 Sep 2022 18:17:36 +0000 (19:17 +0100)
commit93257ed603d72b58bb2616da5b63c4c6737f424b
treeed328dd30a6f419c667f2bfeca785288fced5ce9
parent3c85c1188579bee9c6f8b8f5223daf49b772e594
libstdc++: Add pretty printer for std::stringstreams

To display (o-,i-)stringstreams in the common case, we just print the
underlying stringbuf, without the many ios_base members. In the
unconventional case that the underlying streambuf was redirected, we
report the redirected target.

Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (access_streambuf_ptrs):
New helper function.
(StdStringBufPrinter, StdStringStreamPrinter): New printers.
(build_libstdcxx_dictionary): Register stringstream printers.
* testsuite/libstdc++-prettyprinters/debug.cc: Check string
streams.
* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc