Allow USDT probes to specify PID vs path
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.
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.
Ah, that would explain why I wasn't able to get libstapsdt demo to work, I didn't call the provider demo.
It seems like this issue was already mentioned here: https://github.com/iovisor/bpftrace/blob/c0dbeaf50b94b15167ab291546be0862c5b7578d/src/main.cpp#L151
I believe this is now possible using the wildcard match and pid targeting: https://github.com/iovisor/bpftrace/pull/2734