diff --git a/{{project-name}}/src/main.rs b/{{project-name}}/src/main.rs index 4e15021..6d64c9b 100644 --- a/{{project-name}}/src/main.rs +++ b/{{project-name}}/src/main.rs @@ -103,9 +103,10 @@ async fn main() -> anyhow::Result<()> { } {% case program_type -%} {%- when "kprobe", "kretprobe" -%} + use anyhow::Context as _; let program: &mut KProbe = ebpf.program_mut("{{crate_name}}").unwrap().try_into()?; - program.load()?; - program.attach("{{kprobe}}", 0)?; + program.load().context("load")?; + program.attach("{{kprobe}}", 0).context("attach")?; {%- when "fentry" -%} let btf = Btf::from_sys_fs().context("BTF from sysfs")?; let program: &mut FEntry = ebpf.program_mut("{{crate_name}}").unwrap().try_into()?;