Просмотр исходного кода

fix bug for return value when skip_n is passed

Georgii Rylov 10 месяцев назад
Родитель
Сommit
e488345607
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      core/iwasm/aot/aot_runtime.c
  2. 1 1
      core/iwasm/interpreter/wasm_runtime.c

+ 2 - 2
core/iwasm/aot/aot_runtime.c

@@ -4155,7 +4155,7 @@ aot_copy_callstack_tiny_frame(WASMExecEnv *exec_env, wasm_frame_t *buffer,
         frame -= 1;
         frame -= 1;
         ++count;
         ++count;
     }
     }
-    return count;
+    return count >= skip_n ? count - skip_n : 0;
 }
 }
 
 
 uint32
 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
  * now it poses a risk due to variable size of the frame
  */
  */
 #endif
 #endif
-    return count;
+    return count >= skip_n ? count - skip_n : 0;
 }
 }
 
 
 uint32
 uint32

+ 1 - 1
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;
         cur_frame = cur_frame->prev_frame;
         ++count;
         ++count;
     }
     }
-    return count;
+    return count >= skip_n ? count - skip_n : 0;
 }
 }
 #endif // WAMR_ENABLE_COPY_CALLSTACK
 #endif // WAMR_ENABLE_COPY_CALLSTACK