diff options
author | Sam Clegg <sbc@chromium.org> | 2022-08-04 13:26:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 13:26:16 -0700 |
commit | 1e6196f1b17e43bc78bb14264b376eb09161799c (patch) | |
tree | 3deae793f741050caec1ee2d6bb6b9ac25fd2886 | |
parent | 9c6849b6c53c216ba8656d68fd0fd99dca5e462c (diff) | |
download | binaryen-1e6196f1b17e43bc78bb14264b376eb09161799c.tar.gz binaryen-1e6196f1b17e43bc78bb14264b376eb09161799c.tar.bz2 binaryen-1e6196f1b17e43bc78bb14264b376eb09161799c.zip |
Allow `BINARYEN_DEBUG` environment variable to be used in place of `--debug`. NFC (#4874)
For example I found it useful to able to do something like this:
```
$ BINARYEN_DEBUG=post-emscripten ./test/runner sometest
```
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | src/support/command-line.cpp | 4 |
2 files changed, 9 insertions, 1 deletions
@@ -387,7 +387,11 @@ the [`name-types` pass](https://github.com/WebAssembly/binaryen/blob/main/src/pa Some more notes: * See `bin/wasm-opt --help` for the full list of options and passes. - * Passing `--debug` will emit some debugging info. + * Passing `--debug` will emit some debugging info. Individual debug channels + (defined in the source code via `#define DEBUG_TYPE xxx`) can be enabled by + passing them as list of comma-separated strings. For example: `bin/wasm-opt + --debug=binary`. These debug channels can also be enabled via the + `BINARYEN_DEBUG` environment variable. ### wasm2js diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp index 0147f9044..23ded0346 100644 --- a/src/support/command-line.cpp +++ b/src/support/command-line.cpp @@ -55,6 +55,10 @@ Options::Options(const std::string& command, const std::string& description) : debug(false), positional(Arguments::Zero) { std::string GeneralOption = "General options"; + if (getenv("BINARYEN_DEBUG")) { + setDebugEnabled(getenv("BINARYEN_DEBUG")); + } + add("--version", "", "Output version information and exit", |