bpftrace icon indicating copy to clipboard operation
bpftrace copied to clipboard

Allow USDT probes to specify PID vs path

Open jasonkeene opened this issue 7 years ago • 3 comments

It seems a lot easier for the user to specify the PID for USDT probes vs the path to the binary. This is especially relevant with containers where often it is difficult to resolve the path to the binary from the host and from what I can tell you have to be in the same mount namespace as well.

There is a function in libbcc for this:

https://github.com/iovisor/bcc/blob/ec3fe90b9f8116cb6d8eec940015cd4eda01df7d/src/cc/usdt/usdt.cc#L396

Just pass NULL for path.

jasonkeene avatar Nov 09 '18 19:11 jasonkeene

USDT needs a lot of usability improvements. We should make them work similarly to bcc/trace. Another limitation we have today is that USDT providers must have the same name as the binary today, which doesn't make sense.

mmarchini avatar Nov 09 '18 19:11 mmarchini

Ah, that would explain why I wasn't able to get libstapsdt demo to work, I didn't call the provider demo.

jasonkeene avatar Nov 09 '18 20:11 jasonkeene

It seems like this issue was already mentioned here: https://github.com/iovisor/bpftrace/blob/c0dbeaf50b94b15167ab291546be0862c5b7578d/src/main.cpp#L151

jasonkeene avatar Nov 10 '18 19:11 jasonkeene

I believe this is now possible using the wildcard match and pid targeting: https://github.com/iovisor/bpftrace/pull/2734

jordalgo avatar Dec 13 '23 01:12 jordalgo