From 9011177909529852181726329626234110099652 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 24 Feb 2025 17:08:50 -0500 Subject: Python: Make copy_expr copy with location Co-Authored-By: ltlly --- python/mediumlevelil.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'python/mediumlevelil.py') diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 9a73e95f..d5b1c029 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -988,6 +988,10 @@ class MediumLevelILInstruction(BaseILInstruction): def source_operand(self) -> ExpressionIndex: return ExpressionIndex(self.instr.source_operand) + @property + def source_location(self) -> ILSourceLocation: + return ILSourceLocation.from_instruction(self) + @property def core_operands(self) -> OperandsType: return self.instr.operands @@ -3554,7 +3558,16 @@ class MediumLevelILFunction: :param MediumLevelILInstruction original: the original IL Instruction you want to copy :return: The index of the newly copied expression """ - return self.expr(original.operation, original.raw_operands[0], original.raw_operands[1], original.raw_operands[2], original.raw_operands[3], original.raw_operands[4], original.size) + return self.expr( + original.operation, + original.raw_operands[0], + original.raw_operands[1], + original.raw_operands[2], + original.raw_operands[3], + original.raw_operands[4], + original.size, + original.source_location + ) def replace_expr(self, original: InstructionOrExpression, new: InstructionOrExpression) -> None: """ -- cgit v1.3.1