From a9ebf0dd842dc5b239a233177cfc9ccbd675fba7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 15 Dec 2022 14:02:53 -0800 Subject: In --debug mode, print partial wasm data that was read (#5356) If wasm-opt or wasm-dis are given an invalid binary, after the error message we can also print out the wasm we did manage to read. That includes global stuff like imports and also all the functions up until there. This can help debugging in some situations. Only do this when --debug is passed as it can be very verbose and in general users might not want it. This is technically easy to do, it turns out, since we already use a thrown exception on an error in parsing, and we fill up the wasm as we go, so it just contains what we've read so far, and we can just print it. Fixes #5344 Also switch an existing test's comments to ;; from # which was noticed here. --- test/lit/binary/debug-bad-binary.test.wasm | Bin 0 -> 49 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/lit/binary/debug-bad-binary.test.wasm (limited to 'test/lit/binary/debug-bad-binary.test.wasm') diff --git a/test/lit/binary/debug-bad-binary.test.wasm b/test/lit/binary/debug-bad-binary.test.wasm new file mode 100644 index 000000000..322e29e05 Binary files /dev/null and b/test/lit/binary/debug-bad-binary.test.wasm differ -- cgit v1.2.3