Build binaryen with https://github.com/WebAssembly/binaryen/commit/0b67e96f598c817061e243aa922783b49f0cecab
emcc -s SIDE_MODULE=1 fib.c -O1 --separate-asm -g -o fib.js
cat fib.asm.js | grep " //@line "
asm2wasm -g fib.asm.js -o fib.wasm -bm fib.wasm.txtmap -bu http://example.org/fib.wasm.map
cat fib.wasm.txtmap
(If the txt2map4wasm not install, you can install it via npm install txt2map4wasm
)
txt2map4wasm fib.wasm.txtmap -o fib.wasm.map
Update:
You can generate a source map straight from emcripten with the
-g4
flag