]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::shared_ptr pretty printer for GDB 11
authorJonathan Wakely <jwakely@redhat.com>
Wed, 4 Feb 2026 22:57:34 +0000 (22:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 5 Feb 2026 11:52:36 +0000 (11:52 +0000)
commit2e4e58bb43c5769827cd7c6dde46dd1060740e55
tree5b63c35ec0f10fa69fa6270161fbfff902bcb998
parent1be41ad752945b0ed5c26aa134a30c145a29afd0
libstdc++: Fix std::shared_ptr pretty printer for GDB 11

This pretty printer was updated for GCC 16 to match a change to
std::atomic<shared_ptr<T>>.  But the gdb.Type.is_scalar property was
added in GDB 12.1, so we get an error for older GDB versions.

This adds a workaround for older GDB versions. The gdb.Type.tag property
is None for scalar types, and should always be defined for the
std::atomic class template. Another option would be to use the
is_specialization_of function defined in printers.py, but just checking
for the tag is simpler.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Only
use gdb.Type.is_scalar if supported.
* testsuite/libstdc++-prettyprinters/compat.cc: Test printer for
old implementation of std::atomic<std::shared_ptr<T>>.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc