From 0c6095401fe1305774b9d70f72d65c3fd44f6d42 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 20 Nov 2015 10:14:58 -0800 Subject: add printing in module validity tests --- src/binaryen-shell.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/binaryen-shell.cpp') 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 +#include #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 builder; if (setjmp(trapState) == 0) { - SExpressionWasmBuilder builder(wasm, *curr[1], [&]() { + builder = std::unique_ptr(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 -- cgit v1.2.3