Skip to content

Commit

Permalink
aya: support non-UTF8 probing
Browse files Browse the repository at this point in the history
Fixes #751.
  • Loading branch information
tamird committed Aug 24, 2023
1 parent 8ffd9bb commit eccb84a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions aya/src/programs/kprobe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<KProbeLinkId, ProgramError> {
attach(&mut self.data, self.kind, Path::new(fn_name), offset, None)
pub fn attach<T: AsRef<Path>>(
&mut self,
fn_name: T,
offset: u64,
) -> Result<KProbeLinkId, ProgramError> {
attach(&mut self.data, self.kind, fn_name.as_ref(), offset, None)
}

/// Detaches the program.
Expand Down
4 changes: 2 additions & 2 deletions xtask/public-api/aya.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2896,7 +2896,7 @@ impl<T> core::convert::From<T> 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<aya::programs::kprobe::KProbeLinkId, aya::programs::ProgramError>
pub fn aya::programs::kprobe::KProbe::attach<T: core::convert::AsRef<std::path::Path>>(&mut self, fn_name: T, offset: u64) -> core::result::Result<aya::programs::kprobe::KProbeLinkId, aya::programs::ProgramError>
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<P: core::convert::AsRef<std::path::Path>>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result<Self, aya::programs::ProgramError>
pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind
Expand Down Expand Up @@ -5997,7 +5997,7 @@ impl<T> core::convert::From<T> 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<aya::programs::kprobe::KProbeLinkId, aya::programs::ProgramError>
pub fn aya::programs::kprobe::KProbe::attach<T: core::convert::AsRef<std::path::Path>>(&mut self, fn_name: T, offset: u64) -> core::result::Result<aya::programs::kprobe::KProbeLinkId, aya::programs::ProgramError>
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<P: core::convert::AsRef<std::path::Path>>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result<Self, aya::programs::ProgramError>
pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind
Expand Down

0 comments on commit eccb84a

Please sign in to comment.