Copy read only API behind a flag instead of using user defined callback
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include "bh_common.h"
|
||||
#include "bh_assert.h"
|
||||
#include "bh_log.h"
|
||||
#include "platform_common.h"
|
||||
#include "wasm_export.h"
|
||||
#include "wasm_native.h"
|
||||
#include "wasm_runtime_common.h"
|
||||
@ -1741,18 +1742,19 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env)
|
||||
wasm_exec_env_destroy(exec_env);
|
||||
}
|
||||
|
||||
void
|
||||
wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||
const wasm_frame_callback frame_callback,
|
||||
void *user_data)
|
||||
#if WAMR_ENABLE_COPY_CALLSTACK != 0
|
||||
uint32
|
||||
wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_ptr_t buffer,
|
||||
const uint32 length,
|
||||
const uint32 skip_n)
|
||||
{
|
||||
/*
|
||||
* Note for devs: please refrain from such modifications inside of
|
||||
* wasm_iterate_callstack to preserve async-signal-safety
|
||||
* wasm_copy_callstack to preserve async-signal-safety
|
||||
* - any allocations/freeing memory
|
||||
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
||||
* exec_env->module_inst->module, pointers between stack's bottom and
|
||||
* top_boundary For more details check wasm_iterate_callstack in
|
||||
* top_boundary For more details check wasm_copy_callstack in
|
||||
* wasm_export.h
|
||||
*/
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK
|
||||
@ -1761,17 +1763,18 @@ wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||
|
||||
#if WASM_ENABLE_INTERP != 0
|
||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||
wasm_interp_iterate_callstack(exec_env, frame_callback, user_data);
|
||||
return wasm_interp_copy_callstack(exec_env, buffer, length, skip_n);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_AOT != 0
|
||||
if (module_inst->module_type == Wasm_Module_AoT) {
|
||||
aot_iterate_callstack(exec_env, frame_callback, user_data);
|
||||
return aot_copy_callstack(exec_env, buffer, length, skip_n);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif // WAMR_ENABLE_COPY_CALLSTACK
|
||||
|
||||
bool
|
||||
wasm_runtime_init_thread_env(void)
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "bh_common.h"
|
||||
#include "platform_common.h"
|
||||
#include "wasm_exec_env.h"
|
||||
#include "wasm_native.h"
|
||||
#include "../include/wasm_export.h"
|
||||
@ -464,19 +465,6 @@ typedef struct WASMRegisteredModule {
|
||||
typedef package_type_t PackageType;
|
||||
typedef wasm_section_t WASMSection, AOTSection;
|
||||
|
||||
typedef struct wasm_frame_t {
|
||||
/* wasm_instance_t */
|
||||
void *instance;
|
||||
uint32 module_offset;
|
||||
uint32 func_index;
|
||||
uint32 func_offset;
|
||||
const char *func_name_wp;
|
||||
|
||||
uint32 *sp;
|
||||
uint8 *frame_ref;
|
||||
uint32 *lp;
|
||||
} WASMCApiFrame;
|
||||
|
||||
#if WASM_ENABLE_JIT != 0
|
||||
typedef struct LLVMJITOptions {
|
||||
uint32 opt_level;
|
||||
@ -652,10 +640,11 @@ wasm_runtime_create_exec_env(WASMModuleInstanceCommon *module_inst,
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||
const wasm_frame_callback frame_handler,
|
||||
void *user_data);
|
||||
#if WAMR_ENABLE_COPY_CALLSTACK != 0
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_ptr_t buffer,
|
||||
const uint32 length, const uint32 skip_n);
|
||||
#endif // WAMR_ENABLE_COPY_CALLSTACK
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
|
||||
|
||||
Reference in New Issue
Block a user