Virtual inheritance follow-up (#727)

This commit is contained in:
MS 2024-03-25 11:34:20 -04:00 committed by GitHub
parent 0ed9f37587
commit d9913ead83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 7 deletions

View file

@ -358,24 +358,28 @@ def match_function(self, addr: int, name: str) -> bool:
def match_vtable( def match_vtable(
self, addr: int, name: str, base_class: Optional[str] = None self, addr: int, name: str, base_class: Optional[str] = None
) -> bool: ) -> bool:
# Set up our potential match names
bare_vftable = f"{name}::`vftable'"
for_name = base_class if base_class is not None else name
for_vftable = f"{name}::`vftable'{{for `{for_name}'}}"
# Only allow a match against "Class:`vftable'" # Only allow a match against "Class:`vftable'"
# if this is the derived class. # if this is the derived class.
name = ( if base_class is None or base_class == name:
f"{name}::`vftable'" name_options = (for_vftable, bare_vftable)
if base_class is None or base_class == name else:
else f"{name}::`vftable'{{for `{base_class}'}}" name_options = (for_vftable, for_vftable)
)
row = self._db.execute( row = self._db.execute(
""" """
SELECT recomp_addr SELECT recomp_addr
FROM `symbols` FROM `symbols`
WHERE orig_addr IS NULL WHERE orig_addr IS NULL
AND name = ? AND (name = ? OR name = ?)
AND (compare_type = ?) AND (compare_type = ?)
LIMIT 1 LIMIT 1
""", """,
(name, SymbolType.VTABLE.value), (*name_options, SymbolType.VTABLE.value),
).fetchone() ).fetchone()
if row is not None and self.set_pair(addr, row[0], SymbolType.VTABLE): if row is not None and self.set_pair(addr, row[0], SymbolType.VTABLE):

View file

@ -43,6 +43,13 @@ def set_decorated(self, name: str):
self.node_type = SymbolType.VTABLE self.node_type = SymbolType.VTABLE
self.friendly_name = demangle_vtable(self.decorated_name) self.friendly_name = demangle_vtable(self.decorated_name)
elif self.decorated_name.startswith("??_8"):
# This is the `vbtable' symbol for virtual inheritance.
# Should be okay to reuse demangle_vtable. We still want to
# remove things like "const" from the output.
self.node_type = SymbolType.DATA
self.friendly_name = demangle_vtable(self.decorated_name)
elif self.decorated_name.startswith("??_C@"): elif self.decorated_name.startswith("??_C@"):
self.node_type = SymbolType.STRING self.node_type = SymbolType.STRING
(strlen, _) = demangle_string_const(self.decorated_name) (strlen, _) = demangle_string_const(self.decorated_name)