diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index db9002bb1..bf7f51964 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -4155,7 +4155,7 @@ aot_copy_callstack_tiny_frame(WASMExecEnv *exec_env, wasm_frame_t *buffer, frame -= 1; ++count; } - return count; + return count >= skip_n ? count - skip_n : 0; } uint32 @@ -4205,7 +4205,7 @@ aot_copy_callstack_standard_frame(WASMExecEnv *exec_env, wasm_frame_t *buffer, * now it poses a risk due to variable size of the frame */ #endif - return count; + return count >= skip_n ? count - skip_n : 0; } uint32 diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index 400a6ae6c..64719f7f5 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -4240,7 +4240,7 @@ wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_t *buffer, cur_frame = cur_frame->prev_frame; ++count; } - return count; + return count >= skip_n ? count - skip_n : 0; } #endif // WAMR_ENABLE_COPY_CALLSTACK