From 4108964609171327618627477163339656037111 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 20 Feb 2023 21:58:55 -0500 Subject: Type Containers --- python/binaryview.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'python/binaryview.py') diff --git a/python/binaryview.py b/python/binaryview.py index cd7a0cdf..d7d2a2a8 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -71,6 +71,7 @@ from . import function as _function from . import types as _types from . import platform as _platform from . import deprecation +from . import typecontainer PathType = Union[str, os.PathLike] InstructionsType = Generator[Tuple[List['_function.InstructionTextToken'], int], None, None] @@ -1745,7 +1746,7 @@ class TypeMapping(collections.abc.Mapping): # type: ignore def __del__(self): if core is not None and self._type_list is not None: - core.BNFreeTypeList(self._type_list, len(self)) + core.BNFreeTypeAndNameList(self._type_list, len(self)) def __getitem__(self, key): if self._type_cache is None: @@ -6958,6 +6959,21 @@ class BinaryView: raise ValueError(error_str) return variable.PossibleValueSet(self.arch, result) + @property + def type_container(self) -> 'typecontainer.TypeContainer': + container = core.BNGetAnalysisTypeContainer(self.handle) + return typecontainer.TypeContainer(handle=container) + + @property + def auto_type_container(self) -> 'typecontainer.TypeContainer': + container = core.BNGetAnalysisAutoTypeContainer(self.handle) + return typecontainer.TypeContainer(handle=container) + + @property + def user_type_container(self) -> 'typecontainer.TypeContainer': + container = core.BNGetAnalysisUserTypeContainer(self.handle) + return typecontainer.TypeContainer(handle=container) + def get_type_by_name(self, name: '_types.QualifiedNameType') -> Optional['_types.Type']: """ ``get_type_by_name`` returns the defined type whose name corresponds with the provided ``name`` -- cgit v1.3.1