26.3 Enabling DTrace Support

To enable support for DTrace, add the following lines to the kernel configuration file:

options         KDTRACE_HOOKS
options         DDB_CTF

Note: Users of the AMD64 architecture will want to add the following line to their kernel configuration file:

options         KDTRACE_FRAME

This option provides support for the FBT feature. DTrace will work without this option; however, there will be limited support for function boundary tracing.

All sources must be rebuilt and installed with CTF options. To accomplish this task, rebuild the FreeBSD sources using:

# cd /usr/src

# make WITH_CTF=1 kernel

The system will need to be restarted.

After rebooting and allowing the new kernel to be loaded into memory, support for the Korn shell should be added. This is needed as the DTraceToolkit has several utilities written in ksh. Install the shells/ksh93. It is also possible to run these tools under shells/pdksh or shells/mksh.

Finally, obtain the current DTraceToolkit. If you are running FreeBSD 10, you will find the DTraceToolkit in /usr/share/dtrace. Otherwise, you can install the DTraceToolkit using the sysutils/DTraceToolkit port.