Regenerate GTS 15 libstdc++ pretty printer patches

Regenerate against the current base revision to pick up xmethods.py
changes that diverged after the previous system gcc rebase.

Related: RHEL-169096
This commit is contained in:
Siddhesh Poyarekar 2026-07-22 09:06:00 -04:00
parent 408cd1977c
commit 656c3266f4

View File

@ -1,7 +1,7 @@
libstdc++-v3/python/libstdcxx/v6/__init__.py | 2 +-
libstdc++-v3/python/libstdcxx/v6/printers.py | 14 +++++++++-----
libstdc++-v3/python/libstdcxx/v6/xmethods.py | 2 +-
3 files changed, 11 insertions(+), 7 deletions(-)
libstdc++-v3/python/libstdcxx/v6/printers.py | 20 ++++++++++++++------
libstdc++-v3/python/libstdcxx/v6/xmethods.py | 9 ++++++---
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/libstdc++-v3/python/libstdcxx/v6/__init__.py b/libstdc++-v3/python/libstdcxx/v6/__init__.py
index f40acd922af..5a8f2de195d 100644
@ -14,7 +14,7 @@ index f40acd922af..5a8f2de195d 100644
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 3026de35bbd..5f5963cb595 100644
index 3026de35bbd..052a99a28ed 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1,6 +1,6 @@
@ -25,7 +25,20 @@ index 3026de35bbd..5f5963cb595 100644
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -623,6 +623,9 @@ class StdBitReferencePrinter(printer_base):
@@ -133,7 +133,11 @@ def lookup_templ_spec(templ, *args):
"""
Lookup template specialization templ<args...>.
"""
- t = '{}<{}>'.format(templ, ', '.join([str(a) for a in args]))
+ # Similar to PR67440, str(a) might contain unexpected type qualifiers.
+ t = '{}<{}>'.format(templ, ', '.join([ \
+ a.tag if isinstance(a, gdb.Type) and a.tag \
+ else str(a) \
+ for a in args]))
try:
return gdb.lookup_type(t)
except gdb.error as e:
@@ -623,6 +627,9 @@ class StdBitReferencePrinter(printer_base):
def to_string(self):
if not self._val['_M_p']:
@ -35,7 +48,7 @@ index 3026de35bbd..5f5963cb595 100644
return 'invalid std::vector<bool>::reference'
return bool(self._val['_M_p'].dereference() & (self._val['_M_mask']))
@@ -2827,10 +2830,6 @@ def build_libstdcxx_dictionary():
@@ -2827,10 +2834,6 @@ def build_libstdcxx_dictionary():
# vector<bool>
libstdcxx_printer.add_version('std::', 'locale', StdLocalePrinter)
@ -46,7 +59,7 @@ index 3026de35bbd..5f5963cb595 100644
if hasattr(gdb.Value, 'dynamic_type'):
libstdcxx_printer.add_version('std::', 'error_code',
@@ -2893,6 +2892,8 @@ def build_libstdcxx_dictionary():
@@ -2893,6 +2896,8 @@ def build_libstdcxx_dictionary():
StdChronoDurationPrinter)
libstdcxx_printer.add_version('std::chrono::', 'time_point',
StdChronoTimePointPrinter)
@ -55,7 +68,7 @@ index 3026de35bbd..5f5963cb595 100644
# std::regex components
libstdcxx_printer.add_version('std::__detail::', '_State',
@@ -2968,6 +2969,9 @@ def build_libstdcxx_dictionary():
@@ -2968,6 +2973,9 @@ def build_libstdcxx_dictionary():
# libstdcxx_printer.add_version('std::chrono::(anonymous namespace)', 'Rule',
# StdChronoTimeZoneRulePrinter)
@ -66,7 +79,7 @@ index 3026de35bbd..5f5963cb595 100644
libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter)
diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 436c866e001..109ca10956a 100644
index 692db5f58f6..109ca10956a 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -1,6 +1,6 @@
@ -77,3 +90,31 @@ index 436c866e001..109ca10956a 100644
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,6 +28,8 @@ def get_bool_type():
def get_std_size_type():
return gdb.lookup_type('std::size_t')
+_versioned_namespace = '__8::'
+
def is_specialization_of(x, template_name):
"""
Test whether a type is a specialization of the named class template.
@@ -37,7 +39,8 @@ def is_specialization_of(x, template_name):
"""
if isinstance(x, gdb.Type):
x = x.tag
- return re.match(r'^std::(__\d::|__debug::)?%s<.*>$' % template_name, x) is not None
+ template_name = '(%s)?%s' % (_versioned_namespace, template_name)
+ return re.match(r'^std::(__\d::)?%s<.*>$' % template_name, x) is not None
class LibStdCxxXMethod(gdb.xmethod.XMethod):
def __init__(self, name, worker_class):
@@ -442,7 +445,7 @@ class ListMethodsMatcher(gdb.xmethod.XMethodMatcher):
if method is None or not method.enabled:
return None
val_type = class_type.template_argument(0)
- node_type = gdb.lookup_type(str(class_type) + '::_Node_ptr')
+ node_type = gdb.lookup_type(str(class_type) + '::_Node').pointer()
return method.worker_class(val_type, node_type)
# Xmethods for std::vector