nicolai86
nicolai86

Reputation: 47

dtrace probes missing on yosemite system ruby

On a fresh yosemite install (the one you can download from the mac store) it seems that the ruby dtrace provider is missing:

$ sudo dtrace -l -P ruby
   ID   PROVIDER            MODULE                          FUNCTION NAME
dtrace: failed to match ruby:::: No probe matches description

Downloading/ installing Xcode 6.2 6C131e + CLT does not help, as does installing ruby with (rbenv|ruby-build|rvm|ruby-install) and --enable-dtrace.

I'm stuck. How can I install the missing ruby.usdt ? I'd really like to use dtrace with ruby.

Anyway, appart from that dtrace works fine.

$ dtrace -V
dtrace: Sun D 1.12.1

Ideas?

Upvotes: 0

Views: 448

Answers (1)

Hardy
Hardy

Reputation: 19109

I think there are several things at play here. I don't think there is a ruby provider (anymore). Ruby probes will only be available if you run or have a running ruby process. For example:

sudo dtrace  -c 'ruby -v' -l -m ruby

creates the following output on my system:

   ID   PROVIDER            MODULE                          FUNCTION NAME
315346  ruby85332              ruby                   empty_ary_alloc array-create
315347  ruby85332              ruby                           ary_new array-create
315348  ruby85332              ruby                     vm_call_cfunc cmethod-entry
315349  ruby85332              ruby                     vm_call0_body cmethod-entry
315350  ruby85332              ruby                      vm_exec_core cmethod-entry

Note, the provider is 'ruby85332' where '85332' is the process id. So you have a different provider for each ruby process.

Regarding rvm, enabling dtrace is the default. So --enable-dtrace in

`rvm install ruby-2.0.0 --enable-dtrace`

is really not needed. On the other hand, if you are working on a machine where dtrace requires root/sudo privileges, the dtrace probes will still not compiled, since the compilation process cannot call dtrace.

Personally I have the SUID flag set on the dtrace executable. In my world this should work and I can indeed see in the compilation log that the install process tries to compile the dtrace probes. However, the build still fails with some error regarding 'dev/fd'. What worked for me was to use a pre-compiled version of the ruby vm via rvm mount. For example:

rvm mount -r https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.0.0-p451.tar.bz2

The ruby installed via the command above is also the one I used to create the sample probe listing.

Upvotes: 1

Related Questions