|
@@ -60,6 +60,12 @@ impl KProbe {
|
|
|
} else {
|
|
|
format!("{}", self.kind).into()
|
|
|
};
|
|
|
+
|
|
|
+ let probe_type = if section_name.as_ref().starts_with("kprobe") {
|
|
|
+ quote! { ProbeContext }
|
|
|
+ } else {
|
|
|
+ quote! { RetProbeContext }
|
|
|
+ };
|
|
|
let fn_vis = &self.item.vis;
|
|
|
let fn_name = self.item.sig.ident.clone();
|
|
|
let item = &self.item;
|
|
@@ -67,7 +73,7 @@ impl KProbe {
|
|
|
#[no_mangle]
|
|
|
#[link_section = #section_name]
|
|
|
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
|
|
|
- let _ = #fn_name(::aya_ebpf::programs::ProbeContext::new(ctx));
|
|
|
+ let _ = #fn_name(::aya_ebpf::programs::#probe_type::new(ctx));
|
|
|
return 0;
|
|
|
|
|
|
#item
|
|
@@ -195,7 +201,7 @@ mod tests {
|
|
|
#[no_mangle]
|
|
|
#[link_section = "kretprobe"]
|
|
|
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
|
|
|
- let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
|
|
|
+ let _ = foo(::aya_ebpf::programs::RetProbeContext::new(ctx));
|
|
|
return 0;
|
|
|
|
|
|
fn foo(ctx: ProbeContext) -> u32 {
|