cuviper / probe-rs

probe: Static probes for Rust
Apache License 2.0
92 stars 9 forks source link

Add a DTrace implementation for Mac/illumos/freebsd/etc. #3

Open cuviper opened 10 years ago

cuviper commented 10 years ago

As per rust-lang/rust#6816, DTrace USDT and/or libusdt are plausible backends for probe!.

cuviper commented 9 years ago

There is a DTrace USDT patch set for GDB, which includes a pdtrace script to emulate what the normal proprietary dtrace script does. That may be a good clue for how to emulate USDT in probe! too. The script makes ELF files for DTrace on Oracle Linux though, so I don't know how much info is applicable to Mach-O on OS X.

https://sourceware.org/ml/gdb/2014-10/msg00108.html

No9 commented 9 years ago

Also of interest in this space https://gist.github.com/bcantrill/b7d031db6e35cfd79201

cuviper commented 9 years ago

@No9 - ah, that's using the regular function provider. FWIW, SystemTap can do that too, using debuginfo and/or symbol tables, like stap para-callgraph.stp 'process.function("*")' -c ./hello. [1]

I will edit the title though, to reflect that a DTrace implementation is not just for Mac. @bcantrill if you happen to see this, I'd welcome your expertise to make probe! work for DTrace.

cuviper commented 9 years ago

It's also tricky that he's using Linux binaries, so the target_os conditional won't be enough for libprobe to build a DTrace USDT flavor. Maybe it needs an additional cfg variable, or just wait for a native port.