You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add descriptions for using pid in attach_uprobe and attach_uretprobe. (#5367)
Add descriptions in docs/reference_guide.md for using pid in attach_uprobe and
attach_uretprobe functions that allows uprobes to be attached to a specific process.
The introduced contents were mainly referred by the comments of attach_probe
function in bcc/src/python/bcc/__init__.py.
Instruments the user-level function ```symbol()``` from either the library or binary named by ```location``` using user-level dynamic tracing of the function entry, and attach our C defined function ```name()``` to be called whenever the user-level function is called. If ```sym_off``` is given, the function is attached to the offset within the symbol.
@@ -1718,6 +1718,11 @@ The real address ```addr``` may be supplied in place of ```sym```, in which case
1718
1718
1719
1719
Instead of a symbol name, a regular expression can be provided in ```sym_re```. The uprobe will then attach to symbols that match the provided regular expression.
1720
1720
1721
+
Uprobes can be attached to a specific process by passing `pid` to `attach_uprobe`.
1722
+
By default `pid` is set to -1, indicating the `uprobe` will be attached to all processes.
1723
+
For libraries, the uprobe will attach to the version of the library used by the process if `pid` was given.
1724
+
For how `pid` is used, see examples in [funcinterval](https://github.com/iovisor/bcc/blob/78423e1667db202012bbb032c567589175a2796c/tools/funcinterval.py#L155-L156).
1725
+
1721
1726
Libraries can be given in the name argument without the lib prefix, or with the full path (/usr/lib/...). Binaries can be given only with the full path (/bin/sh).
0 commit comments