The trace command prints a symbolic stack traceback for any process or interrupt stack. When used on a postmortem memory image without options, trace prints the kernel stack that was present in the u-area of the user process that was executing at the time of the panic. trace also displays the contents of the processor registers.
You cannot use trace to examine the kernel stack of the current process on an live system. However, you can use it to examine the kernel stack of processes which are sleeping (for example, while waiting for I/O to complete).
Following an interrupt or exception, the kernel creates an additional stack frame on the system stack for the interrupt handler to use. If there was an interrupt outstanding on the crashed system being examined, crash also displays this interrupt stack and its register values.
Note the following when reading trace output:
Exception frames look very much like standard C stacks. trace searches for a pattern that could be an exception frame. Occasionally, trace will make a mistake. To verify that this is a real exception frame, verify that the frame pointers (FP) have numbers beginning with 4000, indicating that they are in the user area.
trace run on a postmortem dump displays the interrupt stack only if there were interrupts outstanding when the system crashed. If the interrupt stack was corrupted, using trace -i address enables you to get beyond the bad spot.