From a1cb38226d4667672461cb17c79014812bc1f244 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 13 Oct 2024 10:54:00 -0400 Subject: [PATCH] wtf --- {{project-name}}/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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()?;