(self, expr=None)
Add an exit representing a return from this function.
        If this is not an inline call, grab a return address from the state and jump to it.
        If this is not an inline call, set a return expression with the calling convention.
Add an exit representing a return from this function.
        If this is not an inline call, grab a return address from the state and jump to it.
        If this is not an inline call, set a return expression with the calling convention.
Add an exit representing a return from this function . If this is not an inline call grab a return address from the state and jump to it . If this is not an inline call set a return expression with the calling convention .
def ret(self, expr=None):
        """
        Add an exit representing a return from this function.
        If this is not an inline call, grab a return address from the state and jump to it.
        If this is not an inline call, set a return expression with the calling convention.
        """
        self.inhibit_autoret = True

        if expr is not None:
            if o.SIMPLIFY_RETS in self.state.options:
                l.debug("... simplifying")
                l.debug("... before: %s", expr)
                expr = self.state.solver.simplify(expr)
                l.debug("... after: %s", expr)

            if self.symbolic_return:
                size = len(expr)
                new_expr = self.state.solver.Unconstrained(
                        "symbolic_return_" + self.display_name,
                        size,
                        key=('symbolic_return', self.display_name)) #pylint:disable=maybe-no-member
                self.state.add_constraints(new_expr == expr)
                expr = new_expr

            self.ret_expr = expr

        ret_addr = None
        # TODO: I had to put this check here because I don't understand why self.use_state_arguments gets reset to true
        # when calling the function ret. at the calling point the attribute is set to False
        if isinstance(self.addr, SootAddressDescriptor):
            ret_addr = self._compute_ret_addr(expr) #pylint:disable=assignment-from-no-return
        elif self.use_state_arguments:
            ret_addr = self.cc.teardown_callsite(self.state, expr, prototype=self.prototype)

        if not self.should_add_successors:
            l.debug("Returning without setting exits due to 'internal' call.")
            return

        if self.ret_to is not None:
            ret_addr = self.ret_to

        if ret_addr is None:
            raise SimProcedureError("No source for return address in ret() call!")

        self._prepare_ret_state()

        self._exit_action(self.state, ret_addr)
        self.successors.add_successor(self.state, ret_addr, self.state.solver.true, 'Ijk_Ret')
def ret ( self , expr = None ) : self . inhibit_autoret = True if expr is not None : if o . SIMPLIFY_RETS in self . state . options : l . debug ( "... simplifying" ) l . debug ( "... before: %s" , expr ) expr = self . state . solver . simplify ( expr ) l . debug ( "... after: %s" , expr ) if self . symbolic_return : size = len ( expr ) new_expr = self . state . solver . Unconstrained ( "symbolic_return_" + self . display_name , size , key = ( 'symbolic_return' , self . display_name ) ) #pylint:disable=maybe-no-member self . state . add_constraints ( new_expr == expr ) expr = new_expr self . ret_expr = expr ret_addr = None # TODO: I had to put this check here because I don't understand why self.use_state_arguments gets reset to true # when calling the function ret. at the calling point the attribute is set to False if isinstance ( self . addr , SootAddressDescriptor ) : ret_addr = self . _compute_ret_addr ( expr ) #pylint:disable=assignment-from-no-return elif self . use_state_arguments : ret_addr = self . cc . teardown_callsite ( self . state , expr , prototype = self . prototype ) if not self . should_add_successors : l . debug ( "Returning without setting exits due to 'internal' call." ) return if self . ret_to is not None : ret_addr = self . ret_to if ret_addr is None : raise SimProcedureError ( "No source for return address in ret() call!" ) self . _prepare_ret_state ( ) self . _exit_action ( self . state , ret_addr ) self . successors . add_successor ( self . state , ret_addr , self . state . solver . true , 'Ijk_Ret' )