diff options
author | Alon Zakai <azakai@google.com> | 2021-03-25 15:58:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 15:58:56 -0700 |
commit | 36d6f22cf71e66847fb06685b0e634fe0c4f770d (patch) | |
tree | bf84bf119955b4760671c83f950748282b4e1d51 /src/passes/RoundTrip.cpp | |
parent | c248d90bdc2f439ed04b89aff408412dd7711f1f (diff) | |
download | binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.tar.gz binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.tar.bz2 binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.zip |
Print parse errors in reducer and roundtrip (#3737)
Without this, crashes from things like #3736 simply get reported as
"a parse exception was thrown" with no detail.
Diffstat (limited to 'src/passes/RoundTrip.cpp')
-rw-r--r-- | src/passes/RoundTrip.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/passes/RoundTrip.cpp b/src/passes/RoundTrip.cpp index 754881fe4..392710617 100644 --- a/src/passes/RoundTrip.cpp +++ b/src/passes/RoundTrip.cpp @@ -41,7 +41,13 @@ struct RoundTrip : public Pass { auto input = buffer.getAsChars(); WasmBinaryBuilder parser(*module, input); parser.setDWARF(runner->options.debugInfo); - parser.read(); + try { + parser.read(); + } catch (ParseException& p) { + p.dump(std::cerr); + std::cerr << '\n'; + Fatal() << "error in parsing wasm binary"; + } // Reapply features module->features = features; } |