Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to debug and pretty print Wasmi bytecode #972

Open
Robbepop opened this issue Apr 2, 2024 · 0 comments
Open

Make it possible to debug and pretty print Wasmi bytecode #972

Robbepop opened this issue Apr 2, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Robbepop
Copy link
Member

Robbepop commented Apr 2, 2024

Currently it is not easily possible to debug or pretty print Wasmi bytecode as generated by the wasmi::Engine.
However, for debugging or inspection purposes or simply for learning how Wasmi produces bytecode it would be very helpful if Wasmi provided an out-of-the-box way to print Wasmi bytecode of a specified function or maybe even the entire compiled Wasm module.

For this we ideally have 2 different mode as is the standard in Rust: Debug and Display

  • Debug would try to stay as close as possible to the underlying Wasmi bytecode data structures while being a bit more readable to the user.
  • Display would optimize on readability and provide a mostly assembly-like reading experience. This could include costly turning branch offsets into labels dividing basic blocks etc.

The Wasmi CLI should expose this functionality in some way.
It must be noted that these print representations might change over time and thus are not a choice for (de)serialization.

If the resulting code to support this feature is very large we might want to put this entire functionality behind a crate feature debug or printing.

@Robbepop Robbepop added the enhancement New feature or request label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant