Trace UNIX program execution in 10.2

Aug 26, '02 01:15:32AM

Contributed by: mrsid

I have probably read nearly every bit of information on Jaguar, but it seems like nobody has mentioned this yet (it's a major thing to most UNIX people): The 10.2 kernel has the KTRACE option enabled!

This means that it is now possible to trace the flow of a program, for debugging purposes. By running a program like this:

 % ktrace /bin/ls
A file called "ktrace.out" will be generated, which contains information about all system calls the program has used. If any problem occurred, or if you're just curious what happened (e.g. which files were read, etc.), you can view the ktrace.out file using kdump:
 % kdump | less
This will present the dump in (semi-) human readable format. ;)

For more information, check out the ktrace man page.

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020826011532496