-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Segmentation fault (Zero Byte Expected) #97
Comments
@lum1n0us I tried to simplify the code but error still there. (module
(type (;0;) (func (result i64)))
(type (;1;) (func (result f32)))
(import "env" "clock_ms" (func (;0;) (type 0)))
(table (;0;) 1 1 funcref)
(memory (;0;) 1)
(global (;0;) (mut i32) i32.const 8192)
(global (;1;) i32 i32.const 8192)
(global (;2;) i32 i32.const 8192)
(export "memory" (memory 0))
(export "run" (func 1))
(export "__data_end" (global 1))
(export "__heap_base" (global 2))
(func (;1;) (type 1) (result f32)
call 0
f32.convert_i64_s
)
) If load the function in c, it works: static NativeSymbol native_symbols[] = { { "clock_ms", clock_ms, "()I", NULL } };
init_args = (RuntimeInitArgs){ .mem_alloc_type = Alloc_With_Pool,
.mem_alloc_option.pool = { global_heap_buf, sizeof(global_heap_buf) },
.native_module_name = "env",
.native_symbols = native_symbols,
.n_native_symbols = 1 };
if (!wasm_runtime_full_init(&init_args) ||
!(buffer = bh_read_file_to_buffer(wasm_path, &buf_size)) ||
!(module = wasm_runtime_load((uint8 *)buffer, buf_size, error_buf, sizeof(error_buf))) ||
!(module_inst = wasm_runtime_instantiate(module, stack_size, heap_size, error_buf, sizeof(error_buf))) ||
!(exec_env = wasm_runtime_create_exec_env(module_inst, stack_size)) ||
!(func = wasm_runtime_lookup_function(module_inst, "run"))) {
printf("Error: %s\n", error_buf);
return -1;
}
wasm_val_t results[1] = { { .kind = WASM_F32 } };
if (!wasm_runtime_call_wasm_a(exec_env, func, 1, results, 0, NULL)) {
printf("Call failed: %s\n", wasm_runtime_get_exception(module_inst));
return -1;
}
printf("Returned: %f\n", results[0].of.f32); However, when running the equivalent Rust implementation, the following error was encountered: Could you please provide some suggestions to solve the above problem? The code stop here: Stop reason: signal SIGSEGV: address not mapped to object (fault address: 0x4) |
This reverts commit bed7cd3.
Thank you for the update. I will respond as soon as possible. |
#103 should be capable of resolving this issue. Please give it a try. |
Submit: lum1n0us#18 |
I got a error in console: Segmentation fault (core dumped)
A fast reproduce: https://github.com/LoongBuns/wamr-rust-sdk/tree/ohno/examples/wasm-wild
Run with this wasm https://github.com/wasm3/wasm-coremark/blob/main/coremark-minimal.wasm
I'm not quite sure what I need to enable to get iwasm to understand my needs, as this doesn't fail with other runtimes coremark .
The text was updated successfully, but these errors were encountered: