Skip to content

Commit

Permalink
add/improve docstrings for enum/struct/union type lifting
Browse files Browse the repository at this point in the history
  • Loading branch information
blattm committed Aug 16, 2024
1 parent 88fb831 commit 12c9352
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion decompiler/frontend/binaryninja/handlers/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 12c9352

Please sign in to comment.