-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Missing frame in trap message. #1845
Comments
Note: I haven't investigated this at all, just noticed the discrepancy and filed the issue. |
Hm so my guess here is that the |
That would make sense. Unfortunately the CLR doesn't register JIT frames with libunwind, so I think we're probably out of luck here. An incomplete fix would be to replace an empty trace for a trap returned from invoking a This quick hack does produce the expected result since there are no other .NET frames between any of the Wasm frames for this particular test case: if let Some(trap) = out {
let trap = trap.trap.borrow();
if trap.trace().is_empty() {
return Err(Trap::new(trap.to_string()));
}
return Err(trap.clone());
} |
That actually seems somewhat reasonable to me, it may be the case that libbacktrace can't backtrace through a number of native runtimes so having this may not be the worst thing in the world. Especially since we primarily want wasm stack frames the Rust code is guaranteed to see the same wasm frames that the CLR would have seen otherwise. |
In the .NET repo, there's a test (see corresponding .wat file here) that defines a host function that throws a .NET exception. The .NET API turns the exception into a C API
wasm_trap_t
.This results in the following trap message on Windows:
However, on Linux and macOS, the Wasm frame is missing:
We should be able to properly capture the backtrace across all platforms and translate the wasm frames.
See bytecodealliance/wasmtime-dotnet#16 for an example of the failure (ignore the
general I/O error encountered: Invalid argument (os error 22)
failures as that's fixed by a Wasmtime PR under review).cc @alexcrichton @yurydelendik
The text was updated successfully, but these errors were encountered: