1*e5d25bc2SAndrew Brown# Debugging WebAssembly 2*e5d25bc2SAndrew Brown 3*e5d25bc2SAndrew BrownThe following steps describe a common way to debug a WebAssembly module in 4*e5d25bc2SAndrew BrownWasmtime: 5*e5d25bc2SAndrew Brown 6*e5d25bc2SAndrew Brown1. Compile your WebAssembly with debug info enabled, usually `-g`; for 7*e5d25bc2SAndrew Brown example: 8*e5d25bc2SAndrew Brown 9*e5d25bc2SAndrew Brown ```sh 10*e5d25bc2SAndrew Brown clang foo.c -g -o foo.wasm 11*e5d25bc2SAndrew Brown ``` 12*e5d25bc2SAndrew Brown 13*e5d25bc2SAndrew Brown2. Run Wasmtime with the debug info enabled; this is `-g` from the CLI and 14*e5d25bc2SAndrew Brown `Config::debug_info(true)` in an embedding (e.g. see [debugging in a Rust 15*e5d25bc2SAndrew Brown embedding](./examples-rust-debugging.md)) 16*e5d25bc2SAndrew Brown 17*e5d25bc2SAndrew Brown3. Use a supported debugger: 18*e5d25bc2SAndrew Brown 19*e5d25bc2SAndrew Brown ```sh 20*e5d25bc2SAndrew Brown lldb -- wasmtime run -g foo.wasm 21*e5d25bc2SAndrew Brown ``` 22*e5d25bc2SAndrew Brown ```sh 23*e5d25bc2SAndrew Brown gdb --args wasmtime run -g foo.wasm 24*e5d25bc2SAndrew Brown ``` 25