[_GLIBCXX_DEBUG,_GLIBCXX_INLINE_VERSION] Add missing printers

Message ID 0227a2ef-9efa-6bb2-6529-cb38d081f8be@gmail.com
State Accepted, archived
Headers
Series [_GLIBCXX_DEBUG,_GLIBCXX_INLINE_VERSION] Add missing printers |

Checks

Context Check Description
snail/gcc-patches-check success Github commit url

Commit Message

François Dumont Sept. 22, 2022, 5:06 p.m. UTC
  Hi

     This patch fix failures when _GLIBCXX_INLINE_VERSION mode and running:

make check-debug RUNTESTFLAGS=prettyprinters.exp

     libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for 
_GLIBCXX_DEBUG

     In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but 
not template
     parameters. In _GLIBCXX_INLINE_VERSION mode most types are in 
std::__8 namespace but
     not std::__debug containers. We need to register specific type 
printers for this
     combination.

     libstdc++-v3/ChangeLog:

             * python/libstdcxx/v6/printers.py 
(add_one_template_type_printer): Register
             printer for types in std::__debug namespace with template 
parameters in std::__8
             namespace.

Ok to commit ?

François
  

Comments

Jonathan Wakely Sept. 28, 2022, 11:29 p.m. UTC | #1
On Thu, 22 Sept 2022 at 18:06, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Hi
>
>      This patch fix failures when _GLIBCXX_INLINE_VERSION mode and running:
>
> make check-debug RUNTESTFLAGS=prettyprinters.exp
>
>      libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for
> _GLIBCXX_DEBUG
>
>      In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but
> not template
>      parameters. In _GLIBCXX_INLINE_VERSION mode most types are in
> std::__8 namespace but
>      not std::__debug containers. We need to register specific type
> printers for this
>      combination.
>
>      libstdc++-v3/ChangeLog:
>
>              * python/libstdcxx/v6/printers.py
> (add_one_template_type_printer): Register
>              printer for types in std::__debug namespace with template
> parameters in std::__8
>              namespace.
>
> Ok to commit ?

OK, thanks.
  

Patch

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 24a6462e496..1e9d0627e9f 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -2036,6 +2036,10 @@  def add_one_template_type_printer(obj, name, defargs):
         printer = TemplateTypePrinter(ns+name, defargs)
         gdb.types.register_type_printer(obj, printer)
 
+        # Add type printer for same type in debug namespace:
+        printer = TemplateTypePrinter('std::__debug::'+name, defargs)
+        gdb.types.register_type_printer(obj, printer)
+
 class FilteringTypePrinter(object):
     r"""
     A type printer that uses typedef names for common template specializations.