summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-21 09:24:29 -0700
committerGitHub <noreply@github.com>2020-10-21 09:24:29 -0700
commitddf0b590c48448176c9821669eedac6741434bd9 (patch)
treed3fd3d7127fc6b7878064e817d83a9ce9e4bbcb2 /src
parentda68e75db7c4ca9c32d5c296499b51858d432c02 (diff)
downloadbinaryen-ddf0b590c48448176c9821669eedac6741434bd9.tar.gz
binaryen-ddf0b590c48448176c9821669eedac6741434bd9.tar.bz2
binaryen-ddf0b590c48448176c9821669eedac6741434bd9.zip
Fuzzer: Handle log_execution instrumentation, and warn on unknown imports (#3271)
log_execution can be useful to run on a fuzz testcase for debugging purposes. This adds support to --fuzz-exec for printing out those values. IOW, this PR allows the following debugging flow: you run wasm-opt --log-execution on the wasm, then run it in the fuzzer, wasm-opt --fuzz-exec[-before] and you get that logging printed out (showing where we enter functions, exit them, etc.). Also, in general --fuzz-exec ignores unknown imports (so that it can be run on more wasm files, for at least some fuzz testing there). This also adds a warning in that case, so it is less surprising (the behavior does not change in this PR).
Diffstat (limited to 'src')
-rw-r--r--src/tools/execution-results.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index 427100628..f57ffe101 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -40,7 +40,19 @@ struct LoggingExternalInterface : public ShellExternalInterface {
loggings.push_back(argument);
}
std::cout << "]\n";
+ return {};
+ } else if (import->module == ENV) {
+ if (import->base == "log_execution") {
+ std::cout << "[LoggingExternalInterface log-execution";
+ for (auto argument : arguments) {
+ std::cout << ' ' << argument;
+ }
+ std::cout << "]\n";
+ return {};
+ }
}
+ std::cerr << "[LoggingExternalInterface ignoring an unknown import "
+ << import->module << " . " << import->base << '\n';
return {};
}
};