diff options
| author | Rusty Wagner <rusty@vector35.com> | 2017-07-14 18:49:26 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2017-07-14 18:49:26 -0400 |
| commit | 18083837fe452a91e457f02ed8be2abf5fc66877 (patch) | |
| tree | 0a87e12569ca3a981906b16c9555e89892c49112 /python | |
| parent | 35c65d909d1ec36a4a1bad7404c9f986e259f662 (diff) | |
Add API to get list of all definitions or uses of a variable
Diffstat (limited to 'python')
| -rw-r--r-- | python/mediumlevelil.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 76a85a86..8a8d8d0b 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -793,6 +793,32 @@ class MediumLevelILFunction(object): core.BNFreeILInstructionList(instrs) return result + def get_var_definitions(self, var): + count = ctypes.c_ulonglong() + var_data = core.BNVariable() + var_data.type = var.source_type + var_data.index = var.index + var_data.storage = var.storage + instrs = core.BNGetMediumLevelILVariableDefinitions(self.handle, var_data, count) + result = [] + for i in xrange(0, count.value): + result.append(instrs[i]) + core.BNFreeILInstructionList(instrs) + return result + + def get_var_uses(self, var): + count = ctypes.c_ulonglong() + var_data = core.BNVariable() + var_data.type = var.source_type + var_data.index = var.index + var_data.storage = var.storage + instrs = core.BNGetMediumLevelILVariableUses(self.handle, var_data, count) + result = [] + for i in xrange(0, count.value): + result.append(instrs[i]) + core.BNFreeILInstructionList(instrs) + return result + def get_ssa_var_value(self, ssa_var): var_data = core.BNVariable() var_data.type = ssa_var.var.source_type |
