wasm-dis
The wasm-dis
tool converts WAST into WASM. We will use the add.wasm
file that we created in the previous example here. Let's look at the steps:
- In order to convert the WebAssembly module into WebAssembly text format, using the
wasm-dis
binary, run the following command:$ /path/to/build/directory/of/binaryen/wasm-dis add.wasm -o gen-add.wast
- We generate the
gen-add.wast
file using the-o
option with the filename (gen-add.wast
):(module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (func $0 (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) (local.get $1) ) ) )
wasm-dis
first validates the given file (.wasm
) and then converts it into a.wat
file. To check various options supported bywasm-dis
, run the following command:$ /path/to/build/directory/of/binaryen/wasm-dis --help wasm-dis INFILE Un-assemble a .wasm (WebAssembly binary...