diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-20 10:14:58 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-20 10:14:58 -0800 |
commit | 0c6095401fe1305774b9d70f72d65c3fd44f6d42 (patch) | |
tree | ace196be29b21bf0cac53fd92df4ec36f909f9c4 /src/binaryen-shell.cpp | |
parent | b974e9351405880fe1d021e3ae7fda92f1b3bb4f (diff) | |
download | binaryen-0c6095401fe1305774b9d70f72d65c3fd44f6d42.tar.gz binaryen-0c6095401fe1305774b9d70f72d65c3fd44f6d42.tar.bz2 binaryen-0c6095401fe1305774b9d70f72d65c3fd44f6d42.zip |
add printing in module validity tests
Diffstat (limited to 'src/binaryen-shell.cpp')
-rw-r--r-- | src/binaryen-shell.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/binaryen-shell.cpp b/src/binaryen-shell.cpp index 564985c41..10ee011c2 100644 --- a/src/binaryen-shell.cpp +++ b/src/binaryen-shell.cpp @@ -6,6 +6,7 @@ // #include <setjmp.h> +#include <memory> #include "wasm-s-parser.h" #include "wasm-interpreter.h" @@ -282,11 +283,18 @@ int main(int argc, char **argv) { Module wasm; bool invalid = false; jmp_buf trapState; + std::unique_ptr<SExpressionWasmBuilder> builder; if (setjmp(trapState) == 0) { - SExpressionWasmBuilder builder(wasm, *curr[1], [&]() { + builder = std::unique_ptr<SExpressionWasmBuilder>(new SExpressionWasmBuilder(wasm, *curr[1], [&]() { invalid = true; longjmp(trapState, 1); - }); + })); + } + if (print_before || print_after) { + Colors::bold(std::cout); + std::cout << "printing in module invalidity test:\n"; + Colors::normal(std::cout); + std::cout << wasm; } if (!invalid) { // maybe parsed ok, but otherwise incorrect |