angr/engines/soot/engine.py
def prepare_native_return_state(native_state):
        """
        Hook target for native function call returns.

        Recovers and stores the return value from native memory and toggles the
        state, s.t. execution continues in the Soot engine.
        """

        javavm_simos = native_state.project.simos
        ret_state = native_state.copy()

        # set successor flags
        ret_state.regs._ip = ret_state.callstack.ret_addr
        ret_state.scratch.guard = ret_state.solver.true
        ret_state.history.jumpkind = 'Ijk_Ret'

        # if available, lookup the return value in native memory
        ret_var = ret_state.callstack.invoke_return_variable
        if ret_var is not None:
            # get return symbol from native state
            native_cc = javavm_simos.get_native_cc()
            ret_symbol = native_cc.get_return_val(native_state).to_claripy()
            # convert value to java type
            if ret_var.type in ArchSoot.primitive_types:
                # return value has a primitive type
                # => we need to manually cast the return value to the correct size, as this
                #    would be usually done by the java callee
                ret_value = javavm_simos.cast_primitive(ret_state, ret_symbol,
                                                        to_type=ret_var.type)
            else:
                # return value has a reference type
                # => ret_symbol is a opaque ref
                # => lookup corresponding java reference
                ret_value = ret_state.jni_references.lookup(ret_symbol)

        else:
            ret_value = None

        # teardown return state
        SootMixin.prepare_return_state(ret_state, ret_value)

        # finally, delete all local references
        ret_state.jni_references.clear_local_references()

        return [ret_state]

        Hook target for native function call returns.

        Recovers and stores the return value from native memory and toggles the
        state, s.t. execution continues in the Soot engine.
        
Hook target for native function call returns.
Recovers and stores the return value from native memory and toggles the
state, s.t. execution continues in the Soot engine.
Hook target for native function call returns . Recovers and stores the return value from native memory and toggles the state s . t . execution continues in the Soot engine .
def prepare_native_return_state(native_state):
        javavm_simos = native_state.project.simos
        ret_state = native_state.copy()
        ret_state.regs._ip = ret_state.callstack.ret_addr
        ret_state.scratch.guard = ret_state.solver.true
        ret_state.history.jumpkind = 'Ijk_Ret'
        ret_var = ret_state.callstack.invoke_return_variable
        if ret_var is not None:
            native_cc = javavm_simos.get_native_cc()
            ret_symbol = native_cc.get_return_val(native_state).to_claripy()
            if ret_var.type in ArchSoot.primitive_types:
                ret_value = javavm_simos.cast_primitive(ret_state, ret_symbol,
                                                        to_type=ret_var.type)
            else:
                ret_value = ret_state.jni_references.lookup(ret_symbol)
        else:
            ret_value = None
        SootMixin.prepare_return_state(ret_state, ret_value)
        ret_state.jni_references.clear_local_references()
        return [ret_state]
def prepare_native_return_state ( native_state ) : javavm_simos = native_state . project . simos ret_state = native_state . copy ( ) ret_state . regs . _ip = ret_state . callstack . ret_addr ret_state . scratch . guard = ret_state . solver . true ret_state . history . jumpkind = 'Ijk_Ret' ret_var = ret_state . callstack . invoke_return_variable if ret_var is not None : native_cc = javavm_simos . get_native_cc ( ) ret_symbol = native_cc . get_return_val ( native_state ) . to_claripy ( ) if ret_var . type in ArchSoot . primitive_types : ret_value = javavm_simos . cast_primitive ( ret_state , ret_symbol , to_type = ret_var . type ) else : ret_value = ret_state . jni_references . lookup ( ret_symbol ) else : ret_value = None SootMixin . prepare_return_state ( ret_state , ret_value ) ret_state . jni_references . clear_local_references ( ) return [ ret_state ]
Hook target for native function call returns.
Hook target for native function call returns .
"""
        Hook target for native function call returns.

        Recovers and stores the return value from native memory and toggles the
        state, s.t. execution continues in the Soot engine.
        """ # set successor flags # if available, lookup the return value in native memory # get return symbol from native state # convert value to java type # return value has a primitive type # => we need to manually cast the return value to the correct size, as this #    would be usually done by the java callee # return value has a reference type # => ret_symbol is a opaque ref # => lookup corresponding java reference # teardown return state # finally, delete all local references
native_state