summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-05-11 17:15:53 -0400
committerGlenn Smith <glenn@vector35.com>2024-05-23 18:12:10 -0400
commit7038897105235644749844401411645589822198 (patch)
tree1017d2fd685a58fb521be1b78ae23525e3d8366d /python/types.py
parent0824604746724984472975400443871294158813 (diff)
Based pointers
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py35
1 files changed, 32 insertions, 3 deletions
diff --git a/python/types.py b/python/types.py
index 57918612..d240dce9 100644
--- a/python/types.py
+++ b/python/types.py
@@ -27,9 +27,11 @@ import uuid
# Binary Ninja components
from . import _binaryninjacore as core
from .enums import (
- StructureVariant, SymbolType, SymbolBinding, TypeClass, NamedTypeReferenceClass, ReferenceType, VariableSourceType,
- TypeReferenceType, MemberAccess, MemberScope, TypeDefinitionLineType, TokenEscapingType,
- NameType, PointerSuffix
+ StructureVariant, SymbolType, SymbolBinding, TypeClass, NamedTypeReferenceClass,
+ ReferenceType, VariableSourceType,
+ TypeReferenceType, MemberAccess, MemberScope, TypeDefinitionLineType,
+ TokenEscapingType,
+ NameType, PointerSuffix, PointerBaseType
)
from . import callingconvention
from . import function as _function
@@ -998,6 +1000,25 @@ class PointerBuilder(TypeBuilder):
core.BNFreeInstructionText(tokens, count.value)
return result
+ def set_pointer_base(self, base_type: PointerBaseType, base_offset: int):
+ core.BNSetTypeBuilderPointerBase(self._handle, base_type, base_offset)
+
+ @property
+ def pointer_base_type(self) -> PointerBaseType:
+ return PointerBaseType(core.BNTypeBuilderGetPointerBaseType(self._handle))
+
+ @pointer_base_type.setter
+ def pointer_base_type(self, value: PointerBaseType):
+ self.set_pointer_base(value, self.pointer_base_offset)
+
+ @property
+ def pointer_base_offset(self) -> int:
+ return core.BNTypeBuilderGetPointerBaseOffset(self._handle)
+
+ @pointer_base_offset.setter
+ def pointer_base_offset(self, value: int):
+ self.set_pointer_base(self.pointer_base_type, value)
+
class ArrayBuilder(TypeBuilder):
@classmethod
@@ -2857,6 +2878,14 @@ class PointerType(Type):
core.BNFreeInstructionText(tokens, count.value)
return result
+ @property
+ def pointer_base_type(self) -> PointerBaseType:
+ return PointerBaseType(core.BNTypeGetPointerBaseType(self._handle))
+
+ @property
+ def pointer_base_offset(self) -> int:
+ return core.BNTypeGetPointerBaseOffset(self._handle)
+
class ArrayType(Type):
@classmethod