> diff --git a/rust/trace/src/lib.rs b/rust/trace/src/lib.rs > new file mode 100644 > index 00000000000..9b931ddf1de > --- /dev/null > +++ b/rust/trace/src/lib.rs > @@ -0,0 +1,23 @@ > +//! This crate provides macros that aid in using QEMU's tracepoint > +//! functionality. > + > +#[macro_export] > +/// Define the trace-points from the named directory (which should have > slashes > +/// replaced by underscore characters) as functions in a module called > `trace`. > +/// > +/// ```ignore > +/// ::trace::include_trace!("hw_char"); > +/// // ... > +/// trace::trace_pl011_read_fifo_rx_full(); > +/// ``` > +macro_rules! include_trace { > + ($name:literal) => { > + mod trace { > + #[cfg(not(MESON))] > + include!(concat!(env!("MESON_BUILD_ROOT"), "/trace/", $name, > ".rs"));
nit: missing the "trace-" prefix~ include!(concat!(env!("MESON_BUILD_ROOT"), "/trace/", "trace-", $name, ".rs")); > + #[cfg(MESON)] > + include!(concat!("@MESON_BUILD_ROOT@/trace/", $name, ".rs")); ditto > + } > + }; > +} this is the nice work! (but it breaks the doing `cargo build` directly without meson virt env. For `cfd(not(MESON)) case`, could we support placing trace files under local folder? like include!(concat!(env!("CARGO_MANIFEST_DIR"), "src/", "trace-", $name, ".rs")); Or should we add a build.rs like qemu-api does?) Thanks, Zhao