From 12c93525ca309f52f48431156765e583da17ba34 Mon Sep 17 00:00:00 2001 From: Manuel Blatt Date: Fri, 16 Aug 2024 15:44:08 +0200 Subject: [PATCH] add/improve docstrings for enum/struct/union type lifting --- decompiler/frontend/binaryninja/handlers/types.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/decompiler/frontend/binaryninja/handlers/types.py b/decompiler/frontend/binaryninja/handlers/types.py index 37065d77b..929162a75 100644 --- a/decompiler/frontend/binaryninja/handlers/types.py +++ b/decompiler/frontend/binaryninja/handlers/types.py @@ -75,7 +75,8 @@ def lift_named_type_reference_type(self, custom: NamedTypeReferenceType, **kwarg return CustomType(str(custom), custom.width * self.BYTE_SIZE) def lift_enum(self, binja_enum: EnumerationType, name: str = None, **kwargs) -> Enum: - """Lift enum type.""" + """Lift enum type. + The cache lookup uses the hash of the Binary Ninja object instead of names, as names might collide.""" type_id = hash(binja_enum) cached_type = self._lifter.complex_types.retrieve_by_id(type_id) if cached_type is not None: @@ -92,6 +93,8 @@ def lift_enum_member(self, enum_member: EnumerationMember, **kwargs) -> ComplexT return ComplexTypeMember(size=0, name=enum_member.name, offset=-1, type=Integer(32), value=int(enum_member.value)) def lift_struct(self, struct: StructureType, name: str = None, **kwargs) -> Union[Struct, Union_, Class, ComplexTypeName]: + """lift struct/class and union types. + The cache lookup uses the hash of the Binary Ninja object instead of names, as names might collide.""" type_id = hash(struct) cached_type = self._lifter.complex_types.retrieve_by_id(type_id) if cached_type is not None: