From eccb84a2cf44ead21b8f19abd6f7392f59bd1f14 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Thu, 24 Aug 2023 11:17:52 -0400 Subject: [PATCH] aya: support non-UTF8 probing Fixes #751. --- aya/src/programs/kprobe.rs | 8 ++++++-- xtask/public-api/aya.txt | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aya/src/programs/kprobe.rs b/aya/src/programs/kprobe.rs index ef34a3f4..9170e799 100644 --- a/aya/src/programs/kprobe.rs +++ b/aya/src/programs/kprobe.rs @@ -71,8 +71,12 @@ impl KProbe { /// target function. /// /// The returned value can be used to detach from the given function, see [KProbe::detach]. - pub fn attach(&mut self, fn_name: &str, offset: u64) -> Result { - attach(&mut self.data, self.kind, Path::new(fn_name), offset, None) + pub fn attach>( + &mut self, + fn_name: T, + offset: u64, + ) -> Result { + attach(&mut self.data, self.kind, fn_name.as_ref(), offset, None) } /// Detaches the program. diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 1ef6c0c8..76cd2866 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -2896,7 +2896,7 @@ impl core::convert::From for aya::programs::kprobe::KProbeError pub fn aya::programs::kprobe::KProbeError::from(t: T) -> T pub struct aya::programs::kprobe::KProbe impl aya::programs::kprobe::KProbe -pub fn aya::programs::kprobe::KProbe::attach(&mut self, fn_name: &str, offset: u64) -> core::result::Result +pub fn aya::programs::kprobe::KProbe::attach>(&mut self, fn_name: T, offset: u64) -> core::result::Result pub fn aya::programs::kprobe::KProbe::detach(&mut self, link_id: aya::programs::kprobe::KProbeLinkId) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::kprobe::KProbe::from_pin>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind @@ -5997,7 +5997,7 @@ impl core::convert::From for aya::programs::fexit::FExit pub fn aya::programs::fexit::FExit::from(t: T) -> T pub struct aya::programs::KProbe impl aya::programs::kprobe::KProbe -pub fn aya::programs::kprobe::KProbe::attach(&mut self, fn_name: &str, offset: u64) -> core::result::Result +pub fn aya::programs::kprobe::KProbe::attach>(&mut self, fn_name: T, offset: u64) -> core::result::Result pub fn aya::programs::kprobe::KProbe::detach(&mut self, link_id: aya::programs::kprobe::KProbeLinkId) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::kprobe::KProbe::from_pin>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind