summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/lowlevelil.py13
-rw-r--r--python/mediumlevelil.py14
2 files changed, 21 insertions, 6 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index ec7c37fd..b2a28d6e 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -734,9 +734,9 @@ class LowLevelILFunction(object):
if handle is not None:
self.handle = core.handle_of_type(handle, core.BNLowLevelILFunction)
else:
- func_handle = None
- if self.source_function is not None:
- func_handle = self.source_function.handle
+ if self.source_function is None:
+ raise ValueError("IL functions must be created with an associated function")
+ func_handle = self.source_function.handle
self.handle = core.BNCreateLowLevelILFunction(arch.handle, func_handle)
def __del__(self):
@@ -2354,6 +2354,13 @@ class LowLevelILFunction(object):
return None
return result
+ def create_graph(self, settings = None):
+ if settings is not None:
+ settings_obj = settings.handle
+ else:
+ settings_obj = None
+ return binaryninja.flowgraph.CoreFlowGraph(core.BNCreateLowLevelILFunctionGraph(self.handle, settings_obj))
+
class LowLevelILBasicBlock(basicblock.BasicBlock):
def __init__(self, view, handle, owner):
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index d8347ebf..a862adca 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -22,6 +22,7 @@ import ctypes
import struct
# Binary Ninja components
+import binaryninja
from binaryninja import _binaryninjacore as core
from binaryninja.enums import MediumLevelILOperation, InstructionTextTokenType, ILBranchDependence
from binaryninja import basicblock #required for MediumLevelILBasicBlock argument
@@ -616,9 +617,9 @@ class MediumLevelILFunction(object):
if handle is not None:
self.handle = core.handle_of_type(handle, core.BNMediumLevelILFunction)
else:
- func_handle = None
- if self.source_function is not None:
- func_handle = self.source_function.handle
+ if self.source_function is None:
+ raise ValueError("IL functions must be created with an associated function")
+ func_handle = self.source_function.handle
self.handle = core.BNCreateMediumLevelILFunction(arch.handle, func_handle)
def __del__(self):
@@ -939,6 +940,13 @@ class MediumLevelILFunction(object):
return None
return result
+ def create_graph(self, settings = None):
+ if settings is not None:
+ settings_obj = settings.handle
+ else:
+ settings_obj = None
+ return binaryninja.flowgraph.CoreFlowGraph(core.BNCreateMediumLevelILFunctionGraph(self.handle, settings_obj))
+
class MediumLevelILBasicBlock(basicblock.BasicBlock):
def __init__(self, view, handle, owner):