diff --git a/CHANGELOG.md b/CHANGELOG.md index ad600bdc1..e76e6b6eb 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 aabc0a3cd..8defa30b5 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 3ea4ad237..775f8487e 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 edda29366..6dbb93ca0 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 1420b8f2d..86b6b07dc 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; } }