|
|
@ -4,6 +4,7 @@ use std::{
|
|
|
|
io::{self, Write},
|
|
|
|
io::{self, Write},
|
|
|
|
path::Path,
|
|
|
|
path::Path,
|
|
|
|
process,
|
|
|
|
process,
|
|
|
|
|
|
|
|
sync::atomic::{AtomicUsize, Ordering},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
@ -15,6 +16,8 @@ use crate::{
|
|
|
|
sys::{kernel_version, perf_event_open_probe, perf_event_open_trace_point},
|
|
|
|
sys::{kernel_version, perf_event_open_probe, perf_event_open_trace_point},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PROBE_NAME_INDEX: AtomicUsize = AtomicUsize::new(0);
|
|
|
|
|
|
|
|
|
|
|
|
/// Kind of probe program
|
|
|
|
/// Kind of probe program
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
pub enum ProbeKind {
|
|
|
|
pub enum ProbeKind {
|
|
|
@ -158,11 +161,12 @@ fn create_probe_event(
|
|
|
|
KRetProbe | URetProbe => 'r',
|
|
|
|
KRetProbe | URetProbe => 'r',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let event_alias = format!(
|
|
|
|
let event_alias = format!(
|
|
|
|
"aya_{}_{}_{}_{:#x}",
|
|
|
|
"aya_{}_{}_{}_{:#x}_{}",
|
|
|
|
process::id(),
|
|
|
|
process::id(),
|
|
|
|
probe_type_prefix,
|
|
|
|
probe_type_prefix,
|
|
|
|
fn_name,
|
|
|
|
fn_name,
|
|
|
|
offset
|
|
|
|
offset,
|
|
|
|
|
|
|
|
PROBE_NAME_INDEX.fetch_add(1, Ordering::SeqCst)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
let offset_suffix = match kind {
|
|
|
|
let offset_suffix = match kind {
|
|
|
|
KProbe => format!("+{offset}"),
|
|
|
|
KProbe => format!("+{offset}"),
|
|
|
|