[][src]Struct redbpf::UProbe

pub struct UProbe { /* fields omitted */ }

Type to work with uprobes or uretprobes.


impl UProbe[src]

pub fn attach_uprobe(
    &mut self,
    fn_name: Option<&str>,
    offset: u64,
    target: &str,
    pid: Option<pid_t>
) -> Result<()>

Attach the uprobe or uretprobe.

Attach the probe to the function fn_name defined in the library or binary at path. If an offset is given, the probe will be attached at that byte offset inside the function. If fn_name is None, then offset is treated as an absolute address.

If a pid is passed, only the corresponding process is traced.


use redbpf::Module;
let mut module = Module::parse(&std::fs::read("file.elf").unwrap()).unwrap();
for uprobe in module.uprobes_mut() {
    uprobe.attach_uprobe(Some(&uprobe.name()), 0, "/lib/x86_64-linux-gnu/libc-2.30.so", None).unwrap();

pub fn name(&self) -> String[src]

Auto Trait Implementations

impl RefUnwindSafe for UProbe

impl Send for UProbe

impl Sync for UProbe

impl Unpin for UProbe

impl UnwindSafe for UProbe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.