diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-12 16:02:03 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-12 16:12:10 -0700 |
commit | c8293a3f9112ad486f6f3639fc5680d73e7559ca (patch) | |
tree | 69c1cfc1deb8508e29cf888f3b7b2ba26bea4f70 /src/wasm-as.cpp | |
parent | 9f4e494a74a0f2d30c4288f20657bc8fac186a4a (diff) | |
download | binaryen-c8293a3f9112ad486f6f3639fc5680d73e7559ca.tar.gz binaryen-c8293a3f9112ad486f6f3639fc5680d73e7559ca.tar.bz2 binaryen-c8293a3f9112ad486f6f3639fc5680d73e7559ca.zip |
show parse errors in wasm-dis and wasm-as
Diffstat (limited to 'src/wasm-as.cpp')
-rw-r--r-- | src/wasm-as.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/wasm-as.cpp b/src/wasm-as.cpp index 6995859a7..40839ea55 100644 --- a/src/wasm-as.cpp +++ b/src/wasm-as.cpp @@ -43,13 +43,18 @@ int main(int argc, const char *argv[]) { auto input(read_file<std::string>(options.extra["infile"], Flags::Text, options.debug ? Flags::Debug : Flags::Release)); - if (options.debug) std::cerr << "s-parsing..." << std::endl; - SExpressionParser parser(const_cast<char*>(input.c_str())); - Element& root = *parser.root; - - if (options.debug) std::cerr << "w-parsing..." << std::endl; Module wasm; - SExpressionWasmBuilder builder(wasm, *root[0]); + + try{ + if (options.debug) std::cerr << "s-parsing..." << std::endl; + SExpressionParser parser(const_cast<char*>(input.c_str())); + Element& root = *parser.root; + if (options.debug) std::cerr << "w-parsing..." << std::endl; + SExpressionWasmBuilder builder(wasm, *root[0]); + } catch (ParseException& p) { + p.dump(std::cerr); + Fatal() << "error in parsing wasm binary"; + } if (options.debug) std::cerr << "binarification..." << std::endl; BufferWithRandomAccess buffer(options.debug); |