summaryrefslogtreecommitdiff
path: root/python/mediumlevelil.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-04-17 19:38:12 -0400
committerRusty Wagner <rusty@vector35.com>2017-04-17 19:38:12 -0400
commit0ed147b61a1418915c1e243e05aa05e736b6a73f (patch)
tree8cc9c1eeefd7e83ae5468836e6f6bded94b4b335 /python/mediumlevelil.py
parentbf57618db521f8677fd57cd9baa5d77acf025845 (diff)
Use new variable system in functions
Diffstat (limited to 'python/mediumlevelil.py')
-rw-r--r--python/mediumlevelil.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index dff79fbd..f827819f 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -22,7 +22,7 @@ import ctypes
# Binary Ninja components
import _binaryninjacore as core
-from .enums import MediumLevelILOperation, InstructionTextTokenType, ILVariableSourceType, ILBranchDependence
+from .enums import MediumLevelILOperation, InstructionTextTokenType, VariableSourceType, ILBranchDependence
import function
import basicblock
import lowlevelil
@@ -157,11 +157,11 @@ class MediumLevelILInstruction(object):
elif operand_type == "expr":
value = MediumLevelILInstruction(func, instr.operands[i])
elif operand_type == "var":
- var_type = ILVariableSourceType(instr.operands[i] >> 32)
+ var_type = VariableSourceType(instr.operands[i] >> 32)
index = instr.operands[i] & 0xffffffff
identifier = instr.operands[i + 1]
i += 1
- value = function.ILVariable(self.function, var_type, index, identifier)
+ value = function.Variable(self.function, var_type, index, identifier)
elif operand_type == "int_list":
count = ctypes.c_ulonglong()
operand_list = core.BNMediumLevelILGetOperandList(func.handle, self.expr_index, i, count)
@@ -175,10 +175,10 @@ class MediumLevelILInstruction(object):
i += 1
value = []
for j in xrange(count.value / 2):
- var_type = ILVariableSourceType(operand_list[j * 2] >> 32)
+ var_type = VariableSourceType(operand_list[j * 2] >> 32)
index = operand_list[j * 2] & 0xffffffff
identifier = operand_list[(j * 2) + 1]
- value.append(function.ILVariable(self.function, var_type, index, identifier))
+ value.append(function.Variable(self.function, var_type, index, identifier))
core.BNMediumLevelILFreeOperandList(operand_list)
elif operand_type == "var_ssa_list":
count = ctypes.c_ulonglong()
@@ -186,11 +186,11 @@ class MediumLevelILInstruction(object):
i += 1
value = []
for j in xrange(count.value / 3):
- var_type = ILVariableSourceType(operand_list[j * 3] >> 32)
+ var_type = VariableSourceType(operand_list[j * 3] >> 32)
index = operand_list[j * 3] & 0xffffffff
identifier = operand_list[(j * 3) + 1]
var_index = operand_list[(j * 3) + 2]
- value.append((function.ILVariable(self.function, var_type, index, identifier), var_index))
+ value.append((function.Variable(self.function, var_type, index, identifier), var_index))
core.BNMediumLevelILFreeOperandList(operand_list)
elif operand_type == "expr_list":
count = ctypes.c_ulonglong()
@@ -295,7 +295,7 @@ class MediumLevelILInstruction(object):
return core.BNGetMediumLevelILSSAMemoryIndexAtILInstruction(self.function.handle, self.instr_index)
def get_ssa_var_possible_values(self, var, index):
- var_data = core.BNILVariable()
+ var_data = core.BNVariable()
var_data.type = var.type
var_data.index = var.index
var_data.identifier = var.identifier
@@ -304,7 +304,7 @@ class MediumLevelILInstruction(object):
return result
def get_ssa_var_index(self, var):
- var_data = core.BNILVariable()
+ var_data = core.BNVariable()
var_data.type = var.type
var_data.index = var.index
var_data.identifier = var.identifier
@@ -314,17 +314,17 @@ class MediumLevelILInstruction(object):
if isinstance(reg, str):
reg = self.function.arch.regs[reg].index
result = core.BNGetMediumLevelILVariableForRegisterAtInstruction(self.function.handle, reg, self.instr_index)
- return function.ILVariable(self.function.source_function, result.type, result.index, result.identifier)
+ return function.Variable(self.function.source_function, result.type, result.index, result.identifier)
def get_var_for_flag(self, flag):
if isinstance(flag, str):
flag = self.function.arch.regs[flag].index
result = core.BNGetMediumLevelILVariableForFlagAtInstruction(self.function.handle, flag, self.instr_index)
- return function.ILVariable(self.function.source_function, result.type, result.index, result.identifier)
+ return function.Variable(self.function.source_function, result.type, result.index, result.identifier)
def get_var_for_stack_location(self, offset):
result = core.BNGetMediumLevelILVariableForStackLocationAtInstruction(self.function.handle, offset, self.instr_index)
- return function.ILVariable(self.function.source_function, result.type, result.index, result.identifier)
+ return function.Variable(self.function.source_function, result.type, result.index, result.identifier)
def get_reg_value(self, reg):
if isinstance(reg, str):
@@ -654,7 +654,7 @@ class MediumLevelILFunction(object):
return core.BNGetMediumLevelILNonSSAInstructionIndex(self.handle, instr)
def get_ssa_var_definition(self, var, index):
- var_data = core.BNILVariable()
+ var_data = core.BNVariable()
var_data.type = var.type
var_data.index = var.index
var_data.identifier = var.identifier
@@ -671,7 +671,7 @@ class MediumLevelILFunction(object):
def get_ssa_var_uses(self, var, index):
count = ctypes.c_ulonglong()
- var_data = core.BNILVariable()
+ var_data = core.BNVariable()
var_data.type = var.type
var_data.index = var.index
var_data.identifier = var.identifier
@@ -692,7 +692,7 @@ class MediumLevelILFunction(object):
return result
def get_ssa_var_value(self, var, index):
- var_data = core.BNILVariable()
+ var_data = core.BNVariable()
var_data.type = var.type
var_data.index = var.index
var_data.identifier = var.identifier