-
|
i want to attach Uprobe on library with only offset value https://pkg.go.dev/github.com/cilium/ebpf/link#Executable.Uprobe but any symbol or none symbol can i attach Uprobe without symbol value? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
You need The decision happens in func (ex *Executable) address(symbol string, address, offset uint64) (uint64, error) {
if address > 0 {
return address + offset, nil
}
err := ex.lazyLoadSymbols()
...
sym, ok := ex.cachedSymbols[symbol]
if !ok {
return 0, fmt.Errorf("symbol %s: %w", symbol, ErrNoSymbol)
}
...
}With Fix: ex.Uprobe("", objs.Handle_poll_entry, &link.UprobeOptions{
Address: poll_fp,
})If you also need to attach at The |
Beta Was this translation helpful? Give feedback.
-
|
Also opened #2008 to fix the misleading docstring upstream. |
Beta Was this translation helpful? Give feedback.
You need
Address, notOffset. Despite the wording on theUprobedoc ("Setting the Offset field in the options supersedes the symbol's offset"),Offsetis always relative. It gets added to either the resolved symbol address or toAddress, and cannot bypass symbol lookup on its own.The decision happens in
(ex *Executable).address()inlink/uprobe.go:With
Address > 0t…