pub struct GhostScopeLoader { /* private fields */ }Expand description
Main eBPF program loader and manager
Manages the lifecycle of eBPF programs and provides methods for:
- Loading eBPF bytecode
- Attaching/detaching uprobes
- Reading trace events
- Managing BPF maps
Implementations§
Source§impl GhostScopeLoader
impl GhostScopeLoader
Sourcepub fn attach_uprobe(
&mut self,
target_binary: &str,
function_name: &str,
offset: Option<u64>,
pid: Option<i32>,
) -> Result<()>
pub fn attach_uprobe( &mut self, target_binary: &str, function_name: &str, offset: Option<u64>, pid: Option<i32>, ) -> Result<()>
Attach to a uprobe at the specified function offset
Sourcepub fn set_perf_page_count(&mut self, pages: u32)
pub fn set_perf_page_count(&mut self, pages: u32)
Set PerfEventArray page count override (applies when using Perf backend)
Sourcepub fn attach_uprobe_with_program_name(
&mut self,
target_binary: &str,
function_name: &str,
offset: Option<u64>,
pid: Option<i32>,
program_name: Option<&str>,
) -> Result<()>
pub fn attach_uprobe_with_program_name( &mut self, target_binary: &str, function_name: &str, offset: Option<u64>, pid: Option<i32>, program_name: Option<&str>, ) -> Result<()>
Attach to a uprobe with a specific eBPF program name
Sourcepub fn detach_uprobe(&mut self) -> Result<()>
pub fn detach_uprobe(&mut self) -> Result<()>
Detach the uprobe (disable tracing) while keeping eBPF resources loaded This allows the trace to be quickly re-enabled later
Sourcepub fn reattach_uprobe(&mut self) -> Result<()>
pub fn reattach_uprobe(&mut self) -> Result<()>
Reattach the uprobe (re-enable tracing) using previously stored parameters This requires that attach_uprobe was called previously to store the parameters
Sourcepub fn is_uprobe_attached(&self) -> bool
pub fn is_uprobe_attached(&self) -> bool
Check if the uprobe is currently attached
Sourcepub fn destroy(&mut self) -> Result<()>
pub fn destroy(&mut self) -> Result<()>
Completely destroy this loader and all associated resources This detaches any attached uprobes and clears all eBPF resources After calling this, the loader cannot be reused
Sourcepub fn get_attachment_info(&self) -> Option<String>
pub fn get_attachment_info(&self) -> Option<String>
Get current attachment status information
Sourcepub async fn wait_for_events_async(&mut self) -> Result<Vec<ParsedTraceEvent>>
pub async fn wait_for_events_async(&mut self) -> Result<Vec<ParsedTraceEvent>>
Wait for events asynchronously using AsyncFd
Sourcepub fn set_trace_context(&mut self, trace_context: TraceContext)
pub fn set_trace_context(&mut self, trace_context: TraceContext)
Set the trace context for parsing trace events
Sourcepub fn get_map_info(&self) -> Vec<String>
pub fn get_map_info(&self) -> Vec<String>
Get information about loaded maps
Sourcepub fn get_program_info(&self) -> Vec<String>
pub fn get_program_info(&self) -> Vec<String>
Get information about loaded programs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GhostScopeLoader
impl !RefUnwindSafe for GhostScopeLoader
impl Send for GhostScopeLoader
impl Sync for GhostScopeLoader
impl Unpin for GhostScopeLoader
impl !UnwindSafe for GhostScopeLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more