O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Functions

D provides a number of functions you can use in your action scripts. Here is a sampling.

printf

Standard C-style printf function

trace

Displays its argument, using a default format based on the type. Also appends a newline for you.

printa

Print aggregate values, described in more detail below.

ustack

Print the user level stack trace. If the process exits or is killed before the DTrace experiment has completed, DTrace might not be able to resolve the program counter, so you will get hex values rather than symbolic values.

exit

Terminate execution early. Otherwise, you have to type Control-C to quit.

copyin, copyinstr

DTrace scripts execute in kernel scope. Consider probing a system call like write(), which takes a pointer to a buffer with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required