RFC: DTrace probes for debugging or testing in userland programs

Domagoj Stolfa domagoj.stolfa at gmail.com
Tue Dec 20 12:44:12 UTC 2016


Hello,

> No.  A single dtrace process can catch
> fired probes of multiple processes if you want.
> 
> Filtering probes or the results from probes
> is things which should be done in the
> D script level, not in the target binary,
> in the case of DTrace.  My proposal does
> not cover how to use the probes.  It just
> provides probes and a sample script to
> reproduce the (almost) same results with
> printf() debug logging.  The big difference
> is that a developer can use these probes
> for a more complex debug script and/or
> regression test script because the
> probes can carry data structures in
> question, not just a string.

I suppose this comes down to a way that you want to implement this.
Using the SDT provider would require you to attach to the probes using a
D script to perform simple logging, and additional scripts in order to
do more complex operations(such as quantize certain arguments that
you're getting in during that log and what not).

Eventhough your original proposal doesn't cover using those probes, I'm
still puzzled as to how you would actually attach to the probes, i.e.
would you have a script for each daemon separately or would you create 1
big script, causing it to attach to all the probes created in the
separate daemons? There doesn't seem to be a way around having atleast
one script in order to make the probes actually fire(that is, call
dtrace_probe()). This is one of the reasons why I've argued for a
different provider as opposed to SDT.

Another thing that could perhaps be done is implement the probes in the
daemons and simply attach to them whenever the user needs to attach
while leaving the actual logging functionality as is. That way the SDT
provider would dynamically link the function call into the daemon
whenever one would want to trace for more complex logging(there could be
example scripts). The arguments could be documented, allowing for an
easy way to write the scripts and have context of what the arguments
are.

In any case, I would very much like to have access to SDT probes in
daemons in order to get full disclosure on what's happening in real
time, instead of getting a pre-defined log that I would have to
post-process, and would like to thank you for your efforts in doing
this.

-- 
Best regards,
Domagoj Stolfa.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20161220/9c396eb6/attachment.sig>


More information about the freebsd-arch mailing list