Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Jan 14, 2026

Example:

$ wasm-opt --print-binary-offsets
;; Code section offset: 0x14
;; (binary offsets in VM stack traces include this; add it to the offsets below)
(module
  (func $test
    ;; code offset: 0x3
    (call $test)
  )
)

This is like --print but shows binary offsets of each instruction, and also
of the code section (since VM stack traces include it, but we print the
relative offset).

We already have this information - we store it for debug info purposes -
so this just adds some plumbing to make it accessible using a flag.
Unfortunately it does need a few wasm-opt changes, and can't be a
pure pass (it needs to affect how we read the binary, which is before
passes run).

I sometimes need this, so I think it could be useful - thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant