wasmdec is a program that converts WebAssembly binaries to pseudo-C code.
wasmdec will translate this WebAssembly binary:
(module
(func $addTwo (param i32 i32) (result i32)
(return
(i32.add (get_local 0) (get_local 1))
)
)
(export "addTwo" $addTwo)
)To the following pseudo-C code:
int fn_addTwo(int arg0, int arg1) {
return arg0 + arg1;
}- Grab a release on the releases page and select the correct tarball for your OS and arch.
- Extract and run
install.shas root.
Clone the repository with
git clone https://github.com/wwwg/wasmdec.git --recursiveMake sure the recursive flag is set to clone all the submodules.
To build wasmdec and install all of it's dependencies, run sudo make all in the wasmdec directory. GCC 7 or higher is reccomended.
wasmdec -o (output file) (options) input fileWhere options is one of:
-eor--extra: Writes extra information about the binary to output files (Obsolete when using memdump)-mor--memdump: Dumps the binary's memory to disk. Please note that if memdump ONLY dumps memory and doesn't perform any translation.-dor--debug: Print extra debug information to stdout
wasmdec supports almost every single WASM expression, with the exception of atomics. No support for atomics are planned.