switch fail markers to function symbols

This commit is contained in:
2026-04-01 21:17:01 +02:00
parent 353dfae39c
commit 39d2e1c51f
6 changed files with 53 additions and 72 deletions

View File

@ -1,10 +1,16 @@
#include "lib.h"
#include "../lib.h"
#include "bh_platform.h"
#include "wasm_export.h"
#include "__WASM_ARRAY_FILE__"
void fail_start_trace(void) {}
void fail_stop_trace(void) {}
void fail_marker_positive(void) {}
void fail_marker_negative(void) {}
void fail_marker_detected(void) {}
#define STACK_SIZE (4 * 1024)
#define HEAP_SIZE STACK_SIZE
#define RUNTIME_POOL_SIZE 4 * STACK_SIZE
@ -55,19 +61,19 @@ MAIN() {
uint32_t args[1] = {0};
/* call an arbitrary WASM function */
MARKER(start_trace);
fail_start_trace();
if (!wasm_runtime_call_wasm(exec_env, func, 0, args)) {
/* function wasn't called correctly */
}
MARKER(stop_trace);
uint32_t result = args[0];
fail_stop_trace();
/* the return value is stored in args[0] */
uint32_t result = args[0];
if (result == 100) {
MARKER(ok_marker);
fail_marker_positive();
} else {
MARKER(fail_marker);
fail_marker_negative();
}
wasm_runtime_destroy_exec_env(exec_env);