summaryrefslogtreecommitdiff
path: root/python/mediumlevelil.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-03-13 15:07:31 -0400
committerGlenn Smith <glenn@vector35.com>2025-03-13 15:07:31 -0400
commit6baf0bc2f3058efd5e0b33e128729f5b1e6f7f2d (patch)
tree99cb9f3721c6e5e356561dca944c0c51311110a2 /python/mediumlevelil.py
parent1675348020724286554260961199460841497619 (diff)
Python: Add ILSourceLocation to these functions too
Diffstat (limited to 'python/mediumlevelil.py')
-rw-r--r--python/mediumlevelil.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index c7379023..6bcf9807 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -5193,17 +5193,26 @@ class MediumLevelILFunction:
"""
return self.expr(MediumLevelILOperation.MLIL_FCMP_UO, a, b, size=size, source_location=loc)
- def goto(self, label: MediumLevelILLabel) -> ExpressionIndex:
+ def goto(
+ self, label: MediumLevelILLabel, loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
"""
``goto`` returns a goto expression which jumps to the provided MediumLevelILLabel.
:param MediumLevelILLabel label: Label to jump to
+ :param ILSourceLocation loc: location of returned expression
:return: the ExpressionIndex that jumps to the provided label
:rtype: ExpressionIndex
"""
- return ExpressionIndex(core.BNMediumLevelILGoto(self.handle, label.handle))
+ if loc is not None:
+ return ExpressionIndex(core.BNMediumLevelILGotoWithLocation(self.handle, label.handle, loc.address, loc.source_operand))
+ else:
+ return ExpressionIndex(core.BNMediumLevelILGoto(self.handle, label.handle))
- def if_expr(self, operand: ExpressionIndex, t: MediumLevelILLabel, f: MediumLevelILLabel) -> ExpressionIndex:
+ def if_expr(
+ self, operand: ExpressionIndex, t: MediumLevelILLabel, f: MediumLevelILLabel, label: MediumLevelILLabel,
+ loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
"""
``if_expr`` returns the ``if`` expression which depending on condition ``operand`` jumps to the MediumLevelILLabel
``t`` when the condition expression ``operand`` is non-zero and ``f`` when it's zero.
@@ -5211,10 +5220,14 @@ class MediumLevelILFunction:
:param ExpressionIndex operand: comparison expression to evaluate.
:param MediumLevelILLabel t: Label for the true branch
:param MediumLevelILLabel f: Label for the false branch
+ :param ILSourceLocation loc: location of returned expression
:return: the ExpressionIndex for the if expression
:rtype: ExpressionIndex
"""
- return ExpressionIndex(core.BNMediumLevelILIf(self.handle, operand, t.handle, f.handle))
+ if loc is not None:
+ return ExpressionIndex(core.BNMediumLevelILIfWithLocation(self.handle, operand, t.handle, f.handle, loc.address, loc.source_operand))
+ else:
+ return ExpressionIndex(core.BNMediumLevelILIf(self.handle, operand, t.handle, f.handle))
def mark_label(self, label: MediumLevelILLabel) -> None:
"""