master
rs 44 lines 1.22 KB
Raw
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 //! This crate provides macros that aid in using QEMU's tracepoint
4 //! functionality.
5
6 #[cfg(not(windows))]
7 #[doc(hidden)]
8 /// Re-exported item to avoid adding libc as a dependency everywhere.
9 pub use libc::{syslog, LOG_INFO};
10 #[doc(hidden)]
11 /// Re-exported item to avoid adding probe as a dependency everywhere.
12 pub use probe::probe;
13
14 #[macro_export]
15 /// Define the trace-points from the named directory (which should have slashes
16 /// replaced by underscore characters) as functions in a module called `trace`.
17 ///
18 /// ```ignore
19 /// ::trace::include_trace!("hw_char");
20 /// // ...
21 /// trace::trace_pl011_read_fifo_rx_full();
22 /// ```
23 macro_rules! include_trace {
24 ($name:literal) => {
25 #[allow(
26 clippy::ptr_as_ptr,
27 clippy::cast_lossless,
28 clippy::nonminimal_bool,
29 clippy::used_underscore_binding
30 )]
31 mod trace {
32 #[cfg(not(MESON))]
33 include!(concat!(
34 env!("MESON_BUILD_ROOT"),
35 "/trace/trace-",
36 $name,
37 ".rs"
38 ));
39
40 #[cfg(MESON)]
41 include!(concat!("@MESON_BUILD_ROOT@/trace/trace-", $name, ".rs"));
42 }
43 };
44 }