wasm-objdump: Inspect Wasm Sections and Bytes
wasm-objdump prints details about a wasm module: section headers, imports/exports, and disassembly, like objdump for native binaries.
When you need to know exactly what a module imports or exports (a frequent WASI/import debugging question), wasm-objdump gives a fast, greppable view.
What it does
wasm-objdump parses a module and prints the requested views: section summary (-h), full details including imports/exports (-x), instruction disassembly (-d), or raw section bytes (-s).
Common usage
wasm-objdump -h module.wasm
wasm-objdump -x module.wasm
wasm-objdump -d module.wasm
wasm-objdump -x module.wasm | grep -i importOptions
| Flag | What it does |
|---|---|
| -h | Print section headers (a summary of the module) |
| -x | Print detailed section contents (imports, exports, types) |
| -d | Disassemble function bodies |
| -s | Print raw section bytes |
| -j <section> | Restrict output to one section (e.g. -j Import) |
In CI
Use wasm-objdump -x | grep import to assert which host functions a module needs, catching an unexpected new import before it fails at runtime with "unknown import". It is read-only, so it is safe to run on every artifact.
Common errors in CI
"error: magic mismatch" means the file is not a wasm binary. "error: unexpected end" means a truncated module. Passing no view flag prints only minimal info, so specify -x or -d for the detail you expect.