summaryrefslogtreecommitdiff
path: root/python/lowlevelil.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-01-29 19:52:52 -0500
committerRusty Wagner <rusty@vector35.com>2019-01-30 16:09:12 -0500
commit78fc76b12da21dae9be6c57d92e08691a533836f (patch)
tree2652620541088abc6d8e50564b78f3571bc5f31b /python/lowlevelil.py
parentcbb196c27ff14928ac17bd97dc7a537726fbffed (diff)
Prepare API for Python UI bindings
Diffstat (limited to 'python/lowlevelil.py')
-rw-r--r--python/lowlevelil.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index c3f6963a..08c27383 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -727,19 +727,27 @@ class LowLevelILFunction(object):
LLFC_NO !overflow No overflow
======================= ========== ===============================
"""
- def __init__(self, arch, handle = None, source_func = None):
+ def __init__(self, arch = None, handle = None, source_func = None):
self.arch = arch
self.source_function = source_func
if handle is not None:
self.handle = core.handle_of_type(handle, core.BNLowLevelILFunction)
+ if self.source_function is None:
+ self.source_function = binaryninja.function.Function(handle = core.BNGetLowLevelILOwnerFunction(self.handle))
+ if self.arch is None:
+ self.arch = self.source_function.arch
else:
if self.source_function is None:
+ self.handle = None
raise ValueError("IL functions must be created with an associated function")
+ if self.arch is None:
+ self.arch = self.source_function.arch
func_handle = self.source_function.handle
self.handle = core.BNCreateLowLevelILFunction(arch.handle, func_handle)
def __del__(self):
- core.BNFreeLowLevelILFunction(self.handle)
+ if self.handle is not None:
+ core.BNFreeLowLevelILFunction(self.handle)
def __eq__(self, value):
if not isinstance(value, LowLevelILFunction):
@@ -2389,7 +2397,7 @@ class LowLevelILFunction(object):
class LowLevelILBasicBlock(basicblock.BasicBlock):
def __init__(self, view, handle, owner):
- super(LowLevelILBasicBlock, self).__init__(view, handle)
+ super(LowLevelILBasicBlock, self).__init__(handle, view)
self.il_function = owner
def __iter__(self):