summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/function.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py
index 0ec6142d..b350046f 100644
--- a/python/function.py
+++ b/python/function.py
@@ -25,6 +25,7 @@ import traceback
import ctypes
import numbers
import string
+from typing import List
# Binary Ninja components
import binaryninja
@@ -1934,6 +1935,23 @@ class Function(object):
core.BNFreeVariableNameAndTypeList(v, count.value)
return result
+ def get_il_vars(self, il_type: FunctionGraphType) -> List[Variable]:
+ """
+ Get a (read-only) list of the variables used in the given IL. Only
+ accepts ``MediumLevelILFunctionGraph`` or ``HighLevelILFunctionGraph``
+ for ``il_type``, otherwise nothing will be returned.
+ """
+
+ count = ctypes.c_ulonglong()
+ v = core.BNGetFunctionILVariables(self.handle, il_type, count)
+
+ result = []
+ for i in range(0, count.value):
+ result.append(Variable(self, v[i].type, v[i].index, v[i].storage))
+
+ core.BNFreeVariableList(v, count.value)
+ return result
+
@property
def indirect_branches(self):
"""List of indirect branches (read-only)"""