MCPcopy
hub / github.com/cilium/ebpf / Uprobe

Method Uprobe

link/uprobe.go:277–290  ·  view source on GitHub ↗

Uprobe attaches the given eBPF program to a perf event that fires when the given symbol starts executing in the given Executable. For example, /bin/bash::main(): ex, _ = OpenExecutable("/bin/bash") ex.Uprobe("main", prog, nil) When tracing a location for which no ELF symbol is available, or a sh

(symbol string, prog *ebpf.Program, opts *UprobeOptions)

Source from the content-addressed store, hash-verified

275//
276// The returned Link may implement [PerfEvent].
277func (ex *Executable) Uprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions) (Link, error) {
278 u, err := ex.uprobe(symbol, prog, opts, false)
279 if err != nil {
280 return nil, err
281 }
282
283 lnk, err := attachPerfEvent(u, prog, opts.cookie())
284 if err != nil {
285 u.Close()
286 return nil, err
287 }
288
289 return lnk, nil
290}
291
292// Uretprobe attaches the given eBPF program to a perf event that fires right
293// before the given symbol exits. For example, /bin/bash::main():

Callers 10

TestDetachLinkFailFunction · 0.45
TestUprobeFunction · 0.45
TestUprobeInfoFunction · 0.45
TestUprobeExtNotFoundFunction · 0.45
TestUprobeExtWithOptsFunction · 0.45
TestUprobeWithPIDFunction · 0.45
TestUprobeProgramCallFunction · 0.45

Calls 4

uprobeMethod · 0.95
attachPerfEventFunction · 0.85
CloseMethod · 0.65
cookieMethod · 0.45

Tested by 10

TestDetachLinkFailFunction · 0.36
TestUprobeFunction · 0.36
TestUprobeInfoFunction · 0.36
TestUprobeExtNotFoundFunction · 0.36
TestUprobeExtWithOptsFunction · 0.36
TestUprobeWithPIDFunction · 0.36
TestUprobeProgramCallFunction · 0.36