[][src]Macro probe::probe

macro_rules! probe {
    ($provider:ident, $name:ident) => { ... };
    ($provider:ident, $name:ident, $($arg:expr),*) => { ... };
}

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 cast as i64 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

#![feature(asm)]
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
    });
}