Skip to content

Commit efe38cd

Browse files
committed
Remove type name suffix strip facilities
It seems that this mechanism is useless for type names: only variable/function names are decorated with such suffix in GNAT. TN: Q814-002
1 parent d349972 commit efe38cd

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
lines changed

gnatdbg/generics.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import gdb
55

6-
from gnatdbg.utils import gdb_code_names, strip_type_name_suffix
6+
from gnatdbg.utils import gdb_code_names
77

88

99
regex_type = type(re.compile('.*'))
@@ -187,8 +187,7 @@ def _match(self, typ, mt):
187187
types.append(typ)
188188

189189
for typ in types:
190-
type_name = (str(typ) if self.match_pretty_name else
191-
strip_type_name_suffix(typ.name))
190+
type_name = str(typ) if self.match_pretty_name else typ.name
192191

193192
with mt.scope(self, typ):
194193

gnatdbg/printers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import gdb
22

3-
from gnatdbg.utils import strip_type_name_suffix
4-
53

64
class PrettyPrinter(object):
75
"""
@@ -99,8 +97,7 @@ def matches(self, val):
9997
return (
10098
(self.cls.type_pretty_name and
10199
self.cls.type_pretty_name == str(val.type)) or
102-
(self.cls.type_tag and
103-
self.cls.type_tag == strip_type_name_suffix(val.type.tag)) or
100+
(self.cls.type_tag and self.cls.type_tag == val.type.tag) or
104101
(self.cls.type_pattern and self.cls.type_pattern.match(val.type))
105102
)
106103

gnatdbg/utils.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ def strip_typedefs(value):
4848
return value.cast(value.type.strip_typedefs())
4949

5050

51-
def strip_type_name_suffix(type_name):
52-
"""
53-
Strip any type name suffix.
54-
55-
GNAT can add a suffix for body-nested package entities or for protected
56-
objects. This is completely irrelevant for our name matchers, so use this
57-
helper to strip these suffixes before comparing type names.
58-
"""
59-
if type_name:
60-
for body_pkg_suffix in ('X', 'Xb', 'Xn', 'V'):
61-
if type_name.endswith(body_pkg_suffix):
62-
type_name = type_name[:-len(body_pkg_suffix)]
63-
break
64-
return type_name
65-
66-
6751
def coerce_array(array_value):
6852
"""
6953
Turn `array_value` into a proper GDB array value.

0 commit comments

Comments
 (0)