While the DTrace in FreeBSD is very similar to that found in Solaris™, differences exist that should be explained before continuing. The primary difference users will notice is that on FreeBSD, DTrace needs to be specifically enabled. There are kernel options and modules which must be enabled for DTrace to work properly. These will be explained later.
There is a DDB_CTF
kernel option which
is used to enable support for loading the CTF
data from kernel modules and the kernel itself.
CTF is the Solaris™ Compact C Type Format
which encapsulates a reduced form of debugging information
similar to DWARF and the venerable stabs.
This CTF data is added to the binaries by the
ctfconvert
and ctfmerge
build tools. The ctfconvert
utility parses
DWARF ELF debug sections
created by the compiler and ctfmerge
merges
CTF ELF sections from
objects into either executables or shared libraries. More on
how to enable this for the kernel and FreeBSD build is
forthcoming.
Some different providers exist for FreeBSD than for Solaris™.
Most notable is the dtmalloc
provider, which
allows tracing malloc()
by type in the
FreeBSD kernel.
Only root
may use DTrace on FreeBSD.
This is related to security differences, Solaris™ has a few
low level security checks which do not yet exist in FreeBSD. As
such, the /dev/dtrace/dtrace
is
strictly limited to root
users only.
Finally, the DTrace software falls under Sun™'s
CDDL license. The Common
Development and Distribution License
comes with FreeBSD,
see the
/usr/src/cddl/contrib/opensolaris/OPENSOLARIS.LICENSE
or view it online at
http://www.opensolaris.org/os/licensing.
This license means that a FreeBSD kernel with the DTrace options is still BSD licensed; however the CDDL kicks in when the modules are distributed in binary form, or the binaries are loaded.
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.