Skip to content

Conversation

@alexcrichton
Copy link
Member

I was looking at a validation error recently where the offset printed for an error wasn't present in wasm-tools print -p, and that was because the error was on the final end instruction of a function which isn't printed in the text format. This commit updates the output of -p to include a comment with an offset for the end instruction.

I was looking at a validation error recently where the offset printed
for an error wasn't present in `wasm-tools print -p`, and that was
because the error was on the final `end` instruction of a function
which isn't printed in the text format. This commit updates the output
of `-p` to include a comment with an offset for the `end` instruction.
@alexcrichton alexcrichton requested a review from a team as a code owner September 19, 2025 19:13
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team September 19, 2025 19:13
@abrown abrown added this pull request to the merge queue Sep 19, 2025
@keithw
Copy link
Contributor

keithw commented Sep 19, 2025

Would it be possible to print this offset with the closing parenthesis (which currently lacks an offset) rather than with a new (; end ;) line? Semantically, the 0x0b opcode represents the end of the expression rather than an instruction in the function body. Happy to send a followup PR if it would be welcomed.

Merged via the queue into bytecodealliance:main with commit 6ae0930 Sep 19, 2025
34 checks passed
@alexcrichton alexcrichton deleted the print-end-instr-offset branch September 19, 2025 21:09
@alexcrichton
Copy link
Member Author

@keithw I tried to do that at first yeah as I agree it'd be nice to not print the extra line, but I ended up giving up because it felt a bit weird threading things around and figured this was "good enough". All that to say, please feel free to send a follow-up! You'll probably have more success than I

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.

3 participants