WebAssembly / WebAssembly/binaryen

Don't print the whole disassembly upon validation error

Open
#3,372 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

I'm getting "[wasm-validator error in module] unexpected true: Exported global cannot be mutable, on
global$0" error in one of the modules I'm working on.

While I know what's the cause of the issue in this case, the other problem I've noticed due to this is that wasm-opt prints the whole disassembly to the console upon a validation error. In this case the module is below ~400KB, and it takes ~90 seconds to disassemble and print all of it to the console. I suspect, at least some part of this is due to slow-ish console implementation in VSCode, but it also conceals the original error, making it very hard to find and usually out of scrollback buffer altogether.

Could wasm-opt restrain from printing the whole disassembly, instead opting to only print a binary location in the Wasm module and letting user disassemble separately if they really wish to? (e.g. for the error above it's not strictly necessary or helpful anyway)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with wasm-opt's validation-error handling and the path that prints the disassembly. Reproduce the reported validation failure with a module that triggers it, then verify that the original error remains visible without automatically printing the whole module, while a useful binary location is still reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
cli, compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.