summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-10-11 11:02:21 -0700
committerGitHub <noreply@github.com>2016-10-11 11:02:21 -0700
commit1dbdfff8e997f74154dfebce124756e415aa431a (patch)
treec863363dd9bf27c9acb65ab8fedf531f5e911f1d /src
parent56c6ca407f3232ede398b78e7f284f6ed80c9f00 (diff)
downloadbinaryen-1dbdfff8e997f74154dfebce124756e415aa431a.tar.gz
binaryen-1dbdfff8e997f74154dfebce124756e415aa431a.tar.bz2
binaryen-1dbdfff8e997f74154dfebce124756e415aa431a.zip
put heavy pass debugging operations behind BINARYEN_PASS_DEBUG (#755)
Diffstat (limited to 'src')
-rw-r--r--src/passes/pass.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp
index 59155c834..8e7972c25 100644
--- a/src/passes/pass.cpp
+++ b/src/passes/pass.cpp
@@ -143,10 +143,13 @@ void PassRunner::run() {
for (auto pass : passes) {
padding = std::max(padding, pass->name.size());
}
+ bool passDebug = getenv("BINARYEN_PASS_DEBUG") && getenv("BINARYEN_PASS_DEBUG")[0] != '0';
for (auto* pass : passes) {
// ignoring the time, save a printout of the module before, in case this pass breaks it, so we can print the before and after
std::stringstream moduleBefore;
- WasmPrinter::printModule(wasm, moduleBefore);
+ if (passDebug) {
+ WasmPrinter::printModule(wasm, moduleBefore);
+ }
// prepare to run
std::chrono::high_resolution_clock::time_point before;
std::cerr << "[PassRunner] running pass: " << pass->name << "... ";
@@ -169,7 +172,11 @@ void PassRunner::run() {
// validate, ignoring the time
std::cerr << "[PassRunner] (validating)\n";
if (!WasmValidator().validate(*wasm, false, validateGlobally)) {
- std::cerr << "Last pass (" << pass->name << ") broke validation. Here is the module before: \n" << moduleBefore.str() << "\n";
+ if (passDebug) {
+ std::cerr << "Last pass (" << pass->name << ") broke validation. Here is the module before: \n" << moduleBefore.str() << "\n";
+ } else {
+ std::cerr << "Last pass (" << pass->name << ") broke validation. Run with BINARYEN_PASS_DEBUG=1 in the env to see the earlier state\n";
+ }
abort();
}
}