Debugging - WebAssembly/binaryen GitHub Wiki

This page contains notes of interest for people debugging the Binaryen codebase itself.

Useful environment variables

  • BINARYEN_CORES=1: Setting the cores to one will avoid running parallel portions on multiple cores, and instead will run sequentially in a deterministic order. This can help keep debug output deterministic.
  • BINARYEN_PASS_DEBUG=1: This enables expensive validation and it runs that validation after each pass that runs (as opposed to once at the end as we do by default). This also prints out the passes as they run, and their timings.
    • BINARYEN_PASS_DEBUG=2: As 1, but also saves the state before each pass so that it can print out the module before a pass that caused an error.
    • BINARYEN_PASS_DEBUG=3: As 1, but writes out a file after each pass. The files will look like byn-{PROCESS_ID}-{NUMBER}-NAME.wasm (e.g. byn-12345-015-dce.wasm would be the state after running the 15th pass which is DCE).
  • BINARYEN_PRINT_FULL=1: Enables more verbose printing of the text format. This adds a type annotation to each expression, so instead of say (call $foo) it would say [i32] (call $foo) to indicate the value received from the call is an i32.