wasm_copy_callstack

Function wasm_copy_callstack 

Source
pub unsafe extern "C" fn wasm_copy_callstack(
    exec_env: wasm_exec_env_t,
    buffer: *mut wasm_frame_t,
    length: u32,
    skip_n: u32,
    error_buf: *mut c_char,
    error_buf_size: u32,
) -> u32
Expand description

@brief Copy callstack frames.

Caution: This is not a thread-safe function. Ensure the exec_env is suspended before calling it from another thread.

Usage: In the callback to read frames fields use APIs for wasm_frame_t from wasm_c_api.h

Note: The function is async-signal-safe if called with verified arguments. Meaning it’s safe to call it from a signal handler even on a signal interruption from another thread if next variables hold valid pointers

  • exec_env
  • exec_env->module_inst
  • exec_env->module_inst->module

@param exec_env the execution environment that containes frames @param buffer the buffer of size equal length * sizeof(wasm_frame_t) to copy frames to @param length the number of frames to copy @param skip_n the number of frames to skip from the top of the stack

@return number of copied frames