summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2021-07-20 16:28:33 -0400
committerKyleMiles <krm504@nyu.edu>2021-07-26 16:09:18 -0400
commitd999ff47c7c81030e5c592f93d8a1415de058882 (patch)
tree1f8fa0df54d4a3324ebc713179e128b0a662e9d8 /python/function.py
parent661d7c953e7a81e82f3eb6a70c03041354d73bfd (diff)
Python API : Fix copyright year, add .vars to IL functions, remove BNGetFunctionILVariables, prevent variables without types (from Mapped MLIL) from erroring out in function.Variable's __repr__, added BNGetLowLevel-Registers, RegisterStacks, Flags, MemoryVersions, and their respective SSA versions, added `LowLevelILFunction`- `.vars`, `.ssa_vars`, `.registers`, `.register_stacks`, `.flags`, `.memory_versions` and ssa versions.
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/python/function.py b/python/function.py
index 64aacb05..e3d0521c 100644
--- a/python/function.py
+++ b/python/function.py
@@ -828,7 +828,9 @@ class Variable(object):
self._type = var_type
def __repr__(self):
- return "<var %s %s%s>" % (self.type.get_string_before_name(), self.name, self.type.get_string_after_name())
+ if self.type is None:
+ return f"<var unknown-type {self.name}>"
+ return f"<var {self.type.get_string_before_name()} {self.name}{self.type.get_string_after_name()}>"
def __str__(self):
return self.name
@@ -2264,23 +2266,6 @@ 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)"""