summaryrefslogtreecommitdiff
path: root/python/lowlevelil.py
diff options
context:
space:
mode:
authorverylazyguy <verylazyguy@hotmail.com>2019-04-22 15:37:48 -0400
committerBrian Potchik <brian@vector35.com>2019-04-22 15:37:48 -0400
commit07208c9f67823c7b685d393848a36ee23bc252ac (patch)
tree645f40e88c29603e816fcd0c43b21968d4b748bd /python/lowlevelil.py
parent6dcd88173986845a5f2e7074a28c9756ae41f722 (diff)
- make get_ssa family functions return instructions instead of indexes (#1315)
Diffstat (limited to 'python/lowlevelil.py')
-rw-r--r--python/lowlevelil.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index e759ef09..2609f761 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -873,6 +873,9 @@ class LowLevelILFunction(object):
raise IndexError("expected integer instruction index")
if isinstance(i, LowLevelILExpr):
return LowLevelILInstruction(self, i.index)
+ # for backwards compatibility
+ if isinstance(i, LowLevelILInstruction):
+ return i
if (i < 0) or (i >= len(self)):
raise IndexError("index out of range")
return LowLevelILInstruction(self, core.BNGetLowLevelILIndexForInstruction(self.handle, i), i)
@@ -2308,20 +2311,20 @@ class LowLevelILFunction(object):
result = core.BNGetLowLevelILSSARegisterDefinition(self.handle, reg, reg_ssa.version)
if result >= core.BNGetLowLevelILInstructionCount(self.handle):
return None
- return result
+ return self[result]
def get_ssa_flag_definition(self, flag_ssa):
flag = self.arch.get_flag_index(flag_ssa.flag)
result = core.BNGetLowLevelILSSAFlagDefinition(self.handle, flag, flag_ssa.version)
if result >= core.BNGetLowLevelILInstructionCount(self.handle):
return None
- return result
+ return self[result]
def get_ssa_memory_definition(self, index):
result = core.BNGetLowLevelILSSAMemoryDefinition(self.handle, index)
if result >= core.BNGetLowLevelILInstructionCount(self.handle):
return None
- return result
+ return self[result]
def get_ssa_reg_uses(self, reg_ssa):
reg = self.arch.get_reg_index(reg_ssa.reg)
@@ -2329,7 +2332,7 @@ class LowLevelILFunction(object):
instrs = core.BNGetLowLevelILSSARegisterUses(self.handle, reg, reg_ssa.version, count)
result = []
for i in range(0, count.value):
- result.append(instrs[i])
+ result.append(self[instrs[i]])
core.BNFreeILInstructionList(instrs)
return result
@@ -2339,7 +2342,7 @@ class LowLevelILFunction(object):
instrs = core.BNGetLowLevelILSSAFlagUses(self.handle, flag, flag_ssa.version, count)
result = []
for i in range(0, count.value):
- result.append(instrs[i])
+ result.append(self[instrs[i]])
core.BNFreeILInstructionList(instrs)
return result
@@ -2348,7 +2351,7 @@ class LowLevelILFunction(object):
instrs = core.BNGetLowLevelILSSAMemoryUses(self.handle, index, count)
result = []
for i in range(0, count.value):
- result.append(instrs[i])
+ result.append(self[instrs[i]])
core.BNFreeILInstructionList(instrs)
return result