Chrome DevTools includes a capable WebAssembly debugger that lets you set breakpoints, step through disassembled WAT code, inspect local values, and automatically pause on exceptions. Using a sample WASM module with GC types, the post demonstrates how to load a WASM file via a local HTTP server, navigate to it in the Sources panel, and use the 'Pause on exceptions' feature to instantly locate failed ref.cast instructions. The post also argues that for WASM GC type debugging, a proper debugger beats printf-style debugging because WASM's string/print capabilities are limited and GC references are opaque to the host.
Table of contents
The setup and harnessThe debugging processDebugging unexpected exceptionsDebugger vs. printfs in wasmSort: