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 #[doc(hidden)] 7 /// Re-exported item to avoid adding libc as a dependency everywhere. 8 pub use libc::{syslog, LOG_INFO}; 9 10 #[macro_export] 11 /// Define the trace-points from the named directory (which should have slashes 12 /// replaced by underscore characters) as functions in a module called `trace`. 13 /// 14 /// ```ignore 15 /// ::trace::include_trace!("hw_char"); 16 /// // ... 17 /// trace::trace_pl011_read_fifo_rx_full(); 18 /// ``` 19 macro_rules! include_trace { 20 ($name:literal) => { 21 #[allow( 22 clippy::ptr_as_ptr, 23 clippy::cast_lossless, 24 clippy::used_underscore_binding 25 )] 26 mod trace { 27 #[cfg(not(MESON))] 28 include!(concat!( 29 env!("MESON_BUILD_ROOT"), 30 "/trace/trace-", 31 $name, 32 ".rs" 33 )); 34 35 #[cfg(MESON)] 36 include!(concat!("@MESON_BUILD_ROOT@/trace/trace-", $name, ".rs")); 37 } 38 }; 39 } 40