From b808815e57fe680ec2d98ac2dc5bccd610e871ca Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sat, 22 May 2021 12:12:51 +0430 Subject: [PATCH] Meta: Display DistinctNumeric as its alias name in GDB if possible All DistinctNumerics are given an identifying tag, if the tag is generated by the macro, print the alias instead of DistinctNumeric. --- Meta/serenity_gdb.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Meta/serenity_gdb.py b/Meta/serenity_gdb.py index 5cd6aef5db..de7c6d0621 100644 --- a/Meta/serenity_gdb.py +++ b/Meta/serenity_gdb.py @@ -78,6 +78,13 @@ class AKDistinctNumeric: @classmethod def prettyprint_type(cls, type): + actual_name = type.template_argument(1) + parts = actual_name.name.split("::") + unqualified_name = re.sub(r'__(\w+)_tag', r'\1', actual_name.name) + if unqualified_name != actual_name.name: + qualified_name = '::'.join(parts[:-2] + [unqualified_name]) + return qualified_name + # If the tag is malformed, just print DistinctNumeric contained_type = type.template_argument(0) return f'AK::DistinctNumeric<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'