From 3e65a3872524bc55945f2409a11518b8aa5627b9 Mon Sep 17 00:00:00 2001 From: Jia Liu Date: Thu, 14 Aug 2025 17:15:42 +0800 Subject: [PATCH 1/4] demo watch dog --- core/iwasm/aot/aot_runtime.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index d2621fb2fa..13e2c46d16 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -114,6 +114,11 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...) } } +static void +aot_unlinked_import_func_trap(void) { + printf("Unlinked import function called, this should not happen!\n"); +} + static void * runtime_malloc(uint64 size, char *error_buf, uint32 error_buf_size) { @@ -1387,6 +1392,7 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module, const char *field_name = module->import_funcs[i].func_name; LOG_WARNING("warning: failed to link import function (%s, %s)", module_name, field_name); + *func_ptrs = (void*)aot_unlinked_import_func_trap; } } From 978139e5e8f1fd66d7f75d14083b8b2c4cb5fe00 Mon Sep 17 00:00:00 2001 From: Jia Liu Date: Mon, 15 Sep 2025 11:33:23 +0800 Subject: [PATCH 2/4] update msg --- core/iwasm/aot/aot_runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index 13e2c46d16..c49be460c9 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -116,7 +116,7 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...) static void aot_unlinked_import_func_trap(void) { - printf("Unlinked import function called, this should not happen!\n"); + printf("Unlinked import function called\n"); } static void * From 03c0e49b5a27eb1a15fc32eddae1478405bbe5fe Mon Sep 17 00:00:00 2001 From: Jia Liu Date: Mon, 15 Sep 2025 11:37:04 +0800 Subject: [PATCH 3/4] format --- core/iwasm/aot/aot_runtime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index e57fee39dc..0ac46582ce 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -115,7 +115,8 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...) } static void -aot_unlinked_import_func_trap(void) { +aot_unlinked_import_func_trap(void) +{ printf("Unlinked import function called\n"); } @@ -1402,7 +1403,7 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module, * Debugging: Check if the import is resolved at link time */ LOG_WARNING("warning: failed to link import function (%s, %s)", module_name, field_name); - *func_ptrs = (void*)aot_unlinked_import_func_trap; + *func_ptrs = (void *)aot_unlinked_import_func_trap; } } From 520657d8f04eb228ee5de33bc50168b0d84d0295 Mon Sep 17 00:00:00 2001 From: Jia Liu Date: Wed, 17 Sep 2025 15:53:03 +0800 Subject: [PATCH 4/4] update function --- core/iwasm/aot/aot_runtime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index 0ac46582ce..8ed5d0b727 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -115,9 +115,10 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...) } static void -aot_unlinked_import_func_trap(void) +aot_unlinked_import_func_trap(WASMExecEnv *exec_env) { - printf("Unlinked import function called\n"); + AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst; + aot_set_exception_with_id(module_inst, EXCE_CALL_UNLINKED_IMPORT_FUNC); } static void *