diff --git a/CHANGELOG.md b/CHANGELOG.md index ad600bdc154..e76e6b6ebef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Blocks of changes will separated by version increments. ## **[Unreleased]** +- [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows +- [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements - [#451](https://github.com/wasmerio/wasmer/pull/451) Add `--mapdir=src:dest` flag to rename host directories in the guest context - [#457](https://github.com/wasmerio/wasmer/pull/457) Implement file metadata for WASI, fix bugs in WASI clock code for Unix platforms diff --git a/Cargo.toml b/Cargo.toml index aabc0a3cd3b..8defa30b506 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,7 @@ rustc_version = "0.2.3" default = ["fast-tests", "wasi"] "loader:kernel" = ["wasmer-kernel-loader"] debug = ["wasmer-runtime-core/debug"] +trace = ["wasmer-runtime-core/trace"] extra-debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"] # This feature will allow cargo test to run much faster fast-tests = [] diff --git a/lib/runtime-core/Cargo.toml b/lib/runtime-core/Cargo.toml index 3ea4ad23787..775f8487e1b 100644 --- a/lib/runtime-core/Cargo.toml +++ b/lib/runtime-core/Cargo.toml @@ -49,4 +49,5 @@ blake2b_simd = "0.4.1" rustc_version = "0.2.3" [features] -debug = [] \ No newline at end of file +debug = [] +trace = ["debug"] \ No newline at end of file diff --git a/lib/runtime-core/src/macros.rs b/lib/runtime-core/src/macros.rs index edda293664e..6dbb93ca09c 100644 --- a/lib/runtime-core/src/macros.rs +++ b/lib/runtime-core/src/macros.rs @@ -18,6 +18,24 @@ macro_rules! debug { ($fmt:expr, $($arg:tt)*) => {}; } +#[macro_export] +#[cfg(feature = "trace")] +macro_rules! trace { + ($fmt:expr) => { + debug!($fmt) + }; + ($fmt:expr, $($arg:tt)*) => { + debug!($fmt, $($arg)*); + } +} + +#[macro_export] +#[cfg(not(feature = "trace"))] +macro_rules! trace { + ($fmt:expr) => {}; + ($fmt:expr, $($arg:tt)*) => {}; +} + #[macro_export] macro_rules! func { ($func:path) => {{ diff --git a/lib/wasi/src/macros.rs b/lib/wasi/src/macros.rs index 1420b8f2d25..86b6b07dcbd 100644 --- a/lib/wasi/src/macros.rs +++ b/lib/wasi/src/macros.rs @@ -3,11 +3,11 @@ macro_rules! wasi_try { let res: Result<_, crate::syscalls::types::__wasi_errno_t> = $expr; match res { Ok(val) => { - debug!("wasi::wasi_try::val: {:?}", val); + wasmer_runtime_core::trace!("wasi::wasi_try::val: {:?}", val); val } Err(err) => { - debug!("wasi::wasi_try::err: {:?}", err); + wasmer_runtime_core::trace!("wasi::wasi_try::err: {:?}", err); return err; } }