macro_rules! probe {
($provider : ident, $name : ident $(, $arg : expr) * $(,) ?) => { ... };
}
Expand description
Define a static probe point.
This annotates a code location with a name and arguments, and compiles in metadata to let debugging tools locate it.
Arguments
-
provider
- An identifier for naming probe groups. -
name
- An identifier for this specific probe. -
arg
… - Optional data to provide with the probe. Any expression which can be castas isize
is allowed as an argument. The arguments might not be evaluated at all when a debugger is not attached to the probe, depending on the platform implementation, so don’t rely on side effects.
Example
use probe::probe;
fn main() {
probe!(foo, main);
let x = 42;
probe!(foo, show_x, x);
let y = Some(x);
probe!(foo, show_y, match y {
Some(n) => n,
None => -1
});
}