(self, state, successors=None, arguments=None, ret_to=None)
return inst
Call this method with a SimState and a SimSuccessors to execute the procedure.

        Alternately, successors may be none if this is an inline call. In that case, you should
        provide arguments to the function.
Call this method with a SimState and a SimSuccessors to execute the procedure.
Call this method with a SimState and a SimSuccessors to execute the procedure .
def execute(self, state, successors=None, arguments=None, ret_to=None):
        """
        Call this method with a SimState and a SimSuccessors to execute the procedure.

        Alternately, successors may be none if this is an inline call. In that case, you should
        provide arguments to the function.
        """
        # fill out all the fun stuff we don't want to frontload
        if self.addr is None and not state.regs._ip.symbolic:
            self.addr = state.addr
        if self.arch is None:
            self.arch = state.arch
        if self.project is None:
            self.project = state.project
        if self.cc is None:
            if self.arch.name in DEFAULT_CC:
                self.cc = DEFAULT_CC[self.arch.name](self.arch)
            else:
                raise SimProcedureError('There is no default calling convention for architecture %s.'
                                        ' You must specify a calling convention.' % self.arch.name)
        if self.prototype._arch is None:
            self.prototype = self.prototype.with_arch(self.arch)

        inst = copy.copy(self)
        inst.state = state
        inst.successors = successors
        inst.ret_to = ret_to
        inst.inhibit_autoret = False

        # check to see if this is a syscall and if we should override its return value
        if inst.is_syscall:
            state.history.recent_syscall_count = 1

        state._inspect(
            'simprocedure',
            BP_BEFORE,
            simprocedure_name=inst.display_name,
            simprocedure_addr=self.addr,
            simprocedure=inst,
            simprocedure_result=NO_OVERRIDE
        )

        r = state._inspect_getattr('simprocedure_result', NO_OVERRIDE)
        if r is NO_OVERRIDE:
            # get the arguments

            # If the simprocedure is related to a Java function call the appropriate setup_args methos
            # TODO: should we move this?
            if self.is_java:
                sim_args = self._setup_args(inst, state, arguments) #pylint:disable=assignment-from-no-return
                self.use_state_arguments = False

            # handle if this is a continuation from a return
            elif inst.is_continuation:
                if state.callstack.top.procedure_data is None:
                    raise SimProcedureError("Tried to return to a SimProcedure in an inapplicable stack frame!")

                saved_sp, sim_args, saved_local_vars, saved_lr, ideal_addr = state.callstack.top.procedure_data
                if ideal_addr != inst.addr:
                    raise SimShadowStackError("I can't emulate this consequence of stack smashing")
                state.regs.sp = saved_sp
                if saved_lr is not None:
                    state.regs.lr = saved_lr
                inst.arguments = sim_args
                inst.use_state_arguments = True
                inst.call_ret_expr = state.registers.load(state.arch.ret_offset, state.arch.bytes, endness=state.arch.register_endness)
                for name, val in saved_local_vars:
                    setattr(inst, name, val)
            else:
                if arguments is None:
                    inst.use_state_arguments = True
                    inst.arg_session = inst.cc.arg_session(inst.prototype.returnty)
                    sim_args = [inst.cc.next_arg(inst.arg_session, ty).get_value(inst.state) for ty in inst.prototype.args]
                    inst.arguments = sim_args
                else:
                    inst.use_state_arguments = False
                    sim_args = arguments[:inst.num_args]
                    inst.arguments = arguments
                    inst.arg_session = 0

            # run it
            l.debug("Executing %s%s%s%s%s with %s, %s", *(inst._describe_me() + (sim_args, inst.kwargs)))
            r = getattr(inst, inst.run_func)(*sim_args, **inst.kwargs)

        state._inspect(
            'simprocedure',
            BP_AFTER,
            simprocedure_result=r
        )
        r = state._inspect_getattr('simprocedure_result', r)

        if inst.returns and inst.is_function and not inst.inhibit_autoret:
            inst.ret(r)

        return inst
def execute ( self , state , successors = None , arguments = None , ret_to = None ) : # fill out all the fun stuff we don't want to frontload if self . addr is None and not state . regs . _ip . symbolic : self . addr = state . addr if self . arch is None : self . arch = state . arch if self . project is None : self . project = state . project if self . cc is None : if self . arch . name in DEFAULT_CC : self . cc = DEFAULT_CC [ self . arch . name ] ( self . arch ) else : raise SimProcedureError ( 'There is no default calling convention for architecture %s.' ' You must specify a calling convention.' % self . arch . name ) if self . prototype . _arch is None : self . prototype = self . prototype . with_arch ( self . arch ) inst = copy . copy ( self ) inst . state = state inst . successors = successors inst . ret_to = ret_to inst . inhibit_autoret = False # check to see if this is a syscall and if we should override its return value if inst . is_syscall : state . history . recent_syscall_count = 1 state . _inspect ( 'simprocedure' , BP_BEFORE , simprocedure_name = inst . display_name , simprocedure_addr = self . addr , simprocedure = inst , simprocedure_result = NO_OVERRIDE ) r = state . _inspect_getattr ( 'simprocedure_result' , NO_OVERRIDE ) if r is NO_OVERRIDE : # get the arguments # If the simprocedure is related to a Java function call the appropriate setup_args methos # TODO: should we move this? if self . is_java : sim_args = self . _setup_args ( inst , state , arguments ) #pylint:disable=assignment-from-no-return self . use_state_arguments = False # handle if this is a continuation from a return elif inst . is_continuation : if state . callstack . top . procedure_data is None : raise SimProcedureError ( "Tried to return to a SimProcedure in an inapplicable stack frame!" ) saved_sp , sim_args , saved_local_vars , saved_lr , ideal_addr = state . callstack . top . procedure_data if ideal_addr != inst . addr : raise SimShadowStackError ( "I can't emulate this consequence of stack smashing" ) state . regs . sp = saved_sp if saved_lr is not None : state . regs . lr = saved_lr inst . arguments = sim_args inst . use_state_arguments = True inst . call_ret_expr = state . registers . load ( state . arch . ret_offset , state . arch . bytes , endness = state . arch . register_endness ) for name , val in saved_local_vars : setattr ( inst , name , val ) else : if arguments is None : inst . use_state_arguments = True inst . arg_session = inst . cc . arg_session ( inst . prototype . returnty ) sim_args = [ inst . cc . next_arg ( inst . arg_session , ty ) . get_value ( inst . state ) for ty in inst . prototype . args ] inst . arguments = sim_args else : inst . use_state_arguments = False sim_args = arguments [ : inst . num_args ] inst . arguments = arguments inst . arg_session = 0 # run it l . debug ( "Executing %s%s%s%s%s with %s, %s" , * ( inst . _describe_me ( ) + ( sim_args , inst . kwargs ) ) ) r = getattr ( inst , inst . run_func ) ( * sim_args , * * inst . kwargs ) state . _inspect ( 'simprocedure' , BP_AFTER , simprocedure_result = r ) r = state . _inspect_getattr ( 'simprocedure_result' , r ) if inst . returns and inst . is_function and not inst . inhibit_autoret : inst . ret ( r ) return inst