HOWTO in wiki: adding custom dtrace probes in the kernel

Ivan Voras ivoras at freebsd.org
Fri Nov 28 06:59:39 PST 2008


Alexander Leidinger wrote:
> Hi,
> 
> while working on adding dtrace probes to the linuxulator, I thought it
> may be interesting for some people to know how to do this, so I added
> some text/examples into the wiki how to add static dtrace probes in the
> kernel:
>     http://wiki.freebsd.org/HOWTO-dtrace-sdt
> 
> If you are interested in the great debugging possibilities of dtrace,
> don't be afraid to add some probes to the kernel. It's cheap and easy.

Great, thank you!

I have some questions about the document:

Can you document a bit more the construction of the probe:

 SDT_PROBE_DEFINE(foobar, source_file1, foo, entry);
 SDT_PROBE_ARGTYPE(foobar, source_file1, foo, entry, 0, "int");
 SDT_PROBE_ARGTYPE(foobar, source_file1, foo, entry, 1, "const char *");
 SDT_PROBE_DEFINE(foobar, source_file1, foo, return);
 SDT_PROBE_ARGTYPE(foobar, source_file1, foo, return, 0, "int");

What is the meaning of "source_file1" and "foo"?

 SDT_PROBE_DEFINE(foobar, source_file2, bar, entry);
 SDT_PROBE_DEFINE(foobar, source_file2, bar, my_error_condition_name);
 SDT_PROBE_DEFINE(foobar, source_file2, bar, return);

Here: what is my_error_condition_name?

 SDT_PROBE(foobar, source_file1, foo, entry, a, b, 0, 0, 0);

Here: why are the last three arguments zeroes? From the context it looks
like it should be possible to trace an arbitrary number of data - here
a,b. Is the number of arguments implicitly constructed from the probe
definition (STD_PROBE_ARGTYPE(...0...), STD_PROBE_ARGTYPE(...1...))?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20081128/ed975709/signature.pgp


More information about the freebsd-current mailing list