
Wasm core dumps and debugging Rust in Cloudflare Workers
8/14/2023
This post introduces the concept of WebAssembly (Wasm) core dumps as a mechanism for post-mortem debugging of application crashes. It explains how core dumps work, the current status of the Wasm core dump specification, and the experimental support in runtimes like Wasmtime and Wasmer. The post highlights that Cloudflare Workers' runtime (workerd) does not yet support Wasm core dumps due to their experimental nature. To address this gap, the post introduces and details the functionality of `wasm-coredump-rewriter`, a userland tool that can rewrite Wasm modules to inject core dump runtime functionality, enabling the generation of core dump files even in environments without native support. The post provides pseudo-code and explanations of the Wasm code transformation process and the structure of Wasm core dump files, emphasizing the use of DWARF debug information.