Quellcode durchsuchen

Cache vtable disambiguator helper

nosoop vor 10 Monaten
Ursprung
Commit
7ff760de6c
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      src/smgdc/validate.py

+ 6 - 1
src/smgdc/validate.py

@@ -2,6 +2,7 @@
 
 import contextlib
 import enum
+import functools
 import hashlib
 import io
 import itertools
@@ -85,6 +86,10 @@ class LinuxBinary(BaseBinary):
     def __init__(self, path: pathlib.Path, cache_path: pathlib.Path | None = None):
         super().__init__(path, cache_path)
 
+    @functools.cached_property
+    def vtable_disambiguator(self):
+        return self.angr.analyses.VtableDisambiguator()
+
 
 PlatformBinary = WindowsBinary | LinuxBinary
 
@@ -176,7 +181,7 @@ class VirtualFunctionEntry(BaseEntry, tag="vfn"):
         # TODO: implement
         assert isinstance(bin, LinuxBinary)
         self.typename = self.typename or self.typename_from_symbol
-        vtda = bin.angr.analyses.VtableDisambiguator()
+        vtda = bin.vtable_disambiguator
         vtsym = bin.angr.loader.find_symbol(f"_ZTV{self.typename}")
         if not vtsym:
             raise ValueError(f"Could not find vtable symbol _ZTV{self.typename}")