``copy_expr_to`` deep copies an expression from this function into a target function If provided, the function ``sub_expr_handler`` will be called on every copied sub-expression .. warning:: This function should ONLY be called as a part of a lifter or workflow. It will otherwise not do anyth
( self, expr: LowLevelILInstruction, dest: 'LowLevelILFunction', sub_expr_handler: Optional[Callable[[LowLevelILInstruction], ExpressionIndex]] = None )
| 3909 | core.BNReplaceLowLevelILExpr(self.handle, original, new) |
| 3910 | |
| 3911 | def copy_expr_to( |
| 3912 | self, expr: LowLevelILInstruction, dest: 'LowLevelILFunction', |
| 3913 | sub_expr_handler: Optional[Callable[[LowLevelILInstruction], ExpressionIndex]] = None |
| 3914 | ) -> ExpressionIndex: |
| 3915 | """ |
| 3916 | ``copy_expr_to`` deep copies an expression from this function into a target function |
| 3917 | If provided, the function ``sub_expr_handler`` will be called on every copied sub-expression |
| 3918 | |
| 3919 | .. warning:: This function should ONLY be called as a part of a lifter or workflow. It will otherwise not do anything useful as analysis will not be running. |
| 3920 | |
| 3921 | :param LowLevelILInstruction expr: Expression in this function to copy |
| 3922 | :param LowLevelILFunction dest: Function to copy the expression to |
| 3923 | :param sub_expr_handler: Optional function to call on every copied sub-expression |
| 3924 | :return: Index of the copied expression in the target function |
| 3925 | """ |
| 3926 | |
| 3927 | if sub_expr_handler is None: |
| 3928 | sub_expr_handler = lambda sub_expr: self.copy_expr_to(sub_expr, dest) |
| 3929 | loc = ILSourceLocation.from_instruction(expr) |
| 3930 | |
| 3931 | if expr.operation == LowLevelILOperation.LLIL_NOP: |
| 3932 | expr: LowLevelILNop |
| 3933 | return dest.nop(loc) |
| 3934 | if expr.operation == LowLevelILOperation.LLIL_SET_REG: |
| 3935 | expr: LowLevelILSetReg |
| 3936 | return dest.set_reg(expr.size, expr.dest, sub_expr_handler(expr.src), expr.flags, loc) |
| 3937 | if expr.operation == LowLevelILOperation.LLIL_SET_REG_SPLIT: |
| 3938 | expr: LowLevelILSetRegSplit |
| 3939 | return dest.set_reg_split(expr.size, expr.hi, expr.lo, sub_expr_handler(expr.src), expr.flags, loc) |
| 3940 | if expr.operation == LowLevelILOperation.LLIL_SET_REG_STACK_REL: |
| 3941 | expr: LowLevelILSetRegStackRel |
| 3942 | return dest.set_reg_stack_top_relative(expr.size, expr.stack, sub_expr_handler(expr.dest), sub_expr_handler(expr.src), expr.flags, loc) |
| 3943 | if expr.operation == LowLevelILOperation.LLIL_REG_STACK_PUSH: |
| 3944 | expr: LowLevelILRegStackPush |
| 3945 | return dest.reg_stack_push(expr.size, expr.stack, sub_expr_handler(expr.src), expr.flags, loc) |
| 3946 | if expr.operation == LowLevelILOperation.LLIL_SET_FLAG: |
| 3947 | expr: LowLevelILSetFlag |
| 3948 | return dest.set_flag(expr.dest.name, sub_expr_handler(expr.src), loc) |
| 3949 | if expr.operation == LowLevelILOperation.LLIL_LOAD: |
| 3950 | expr: LowLevelILLoad |
| 3951 | return dest.load(expr.size, sub_expr_handler(expr.src), expr.flags, loc) |
| 3952 | if expr.operation == LowLevelILOperation.LLIL_STORE: |
| 3953 | expr: LowLevelILStore |
| 3954 | return dest.store(expr.size, sub_expr_handler(expr.dest), sub_expr_handler(expr.src), expr.flags, loc) |
| 3955 | if expr.operation == LowLevelILOperation.LLIL_REG: |
| 3956 | expr: LowLevelILReg |
| 3957 | return dest.reg(expr.size, expr.src, loc) |
| 3958 | if expr.operation == LowLevelILOperation.LLIL_REG_SPLIT: |
| 3959 | expr: LowLevelILRegSplit |
| 3960 | return dest.reg_split(expr.size, expr.hi, expr.lo, loc) |
| 3961 | if expr.operation == LowLevelILOperation.LLIL_REG_STACK_REL: |
| 3962 | expr: LowLevelILRegStackRel |
| 3963 | return dest.reg_stack_top_relative(expr.size, expr.stack, sub_expr_handler(expr.src), loc) |
| 3964 | if expr.operation == LowLevelILOperation.LLIL_REG_STACK_POP: |
| 3965 | expr: LowLevelILRegStackPop |
| 3966 | return dest.reg_stack_pop(expr.size, expr.stack, loc) |
| 3967 | if expr.operation == LowLevelILOperation.LLIL_FLAG: |
| 3968 | expr: LowLevelILFlag |
no test coverage detected