summaryrefslogtreecommitdiff
path: root/python/lowlevelil.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-07-25 20:20:24 -0400
committerRusty Wagner <rusty@vector35.com>2017-07-25 20:20:24 -0400
commit24b090492a216278fbc0e43e8f01cec13fa59696 (patch)
tree5a4f5071fb13e87a7dda077279889441e1734326 /python/lowlevelil.py
parent111add984b0a517966f133ae69c51d2084dee985 (diff)
Add mappings from LLIL to normal MLIL
Diffstat (limited to 'python/lowlevelil.py')
-rw-r--r--python/lowlevelil.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 62e33a75..08ca04e6 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -328,8 +328,16 @@ class LowLevelILInstruction(object):
core.BNGetLowLevelILNonSSAExprIndex(self.function.handle, self.expr_index))
@property
+ def medium_level_il(self):
+ """Gets the medium level IL expression corresponding to this expression (may be None for eliminated instructions)"""
+ expr = self.function.get_medium_level_il_expr_index(self.expr_index)
+ if expr is None:
+ return None
+ return mediumlevelil.MediumLevelILInstruction(self.function.medium_level_il, expr)
+
+ @property
def mapped_medium_level_il(self):
- """Gets the medium level IL expression corresponding to this expression"""
+ """Gets the mapped medium level IL expression corresponding to this expression"""
expr = self.function.get_mapped_medium_level_il_expr_index(self.expr_index)
if expr is None:
return None
@@ -1652,6 +1660,24 @@ class LowLevelILFunction(object):
result = function.RegisterValue(self.arch, value)
return result
+ def get_medium_level_il_instruction_index(self, instr):
+ med_il = self.medium_level_il
+ if med_il is None:
+ return None
+ result = core.BNGetMediumLevelILInstructionIndex(self.handle, instr)
+ if result >= core.BNGetMediumLevelILInstructionCount(med_il.handle):
+ return None
+ return result
+
+ def get_medium_level_il_expr_index(self, expr):
+ med_il = self.medium_level_il
+ if med_il is None:
+ return None
+ result = core.BNGetMediumLevelILExprIndex(self.handle, expr)
+ if result >= core.BNGetMediumLevelILExprCount(med_il.handle):
+ return None
+ return result
+
def get_mapped_medium_level_il_instruction_index(self, instr):
med_il = self.mapped_medium_level_il
if med_il is None: