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)
| 275 | // |
| 276 | // The returned Link may implement [PerfEvent]. |
| 277 | func (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(): |