wasmtime: Unable to backtrace JIT frames on Windows
Trying to find a way to utilize the already existing mechanism of CL to provide UNWIND_INFO for Windows (see crates/jit/src/function_table.rs). The platform StackWalkEx/StackWalk64 or RtlCaptureStackBackTrace fail to utilize the registered with RtlAddFunctionTable information.
I created a test case at https://github.com/yurydelendik/wasmtime/tree/win-stacktrace : run cargo run --example hello from the “crates/api” directory. The following output is observed:
RtlCaptureStackBackTrace: [0x7ff762a35fde, 0x7ff762a36247, 0x7ff76309b52f, 0x7ff76309b64a, 0x7ffdb8ca6b26, 0x7ffdb8c44849, 0x7ffdb8ce34ee,
0x164298c002f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] 8
trace/StackWalk: 0x7ff762a5a0f9 0x7ff762a5a6df 0x7ff762a36124 0x7ff762a36247 0x7ff76309b52f 0x7ff76309b64a 0x7ffdb8ca6b26 0x7ffdb8c44849 0x7ffdb8ce34ee
0x164298c002f 0x287d36ed40 0x7ff762a593f6 0x7ff762a36344 0x7ff76309b35d 0x7ff762a3685d 0x7ff7626a7824
The expected output is something provided by VS. Notice that VS has three entries in form of/starting with 000001xxxxxx002f , but wasmtime produces only first one.

These 3 entries are: call-to-rust trampoline, wasmtime jit function, and rust-to-jit trampoline.
cc @peterhuene
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (16 by maintainers)
I think this issue is now resolved with #823.
@yurydelendik if I’m wrong and there’s still work to do here for stack walking on Windows, please reopen. Thanks!
I got some positive results with https://github.com/yurydelendik/wasmtime/commit/21ff2b9f62f03751060e7489665f2d943c1d0a3f
Do we need to extend https://github.com/rust-lang/backtrace-rs with such functionality or we just limit it to wasmtime only?
I’ll help take a look at this when I’m back from vacation on Thursday.