Method and apparatus for tracking thread stacks during a trace of a
computer program. Hardware assistance mechanisms allow a processor to
autonomically maintain a thread work area for each thread where a call
stack is stored. An operating system informs the processor of the size of
the data area to allocate to a particular thread work area. When a trace
of a computer program is to be performed, trace software, informs the
processor to begin maintaining thread call stack information in the
thread work area. For each thread in the computer program execution, the
processor maintains a work area having a size that is determined based on
the size communicated by the operating system. The processor contains
microcode to cause the processor to automatically store thread tracking
information in the work areas designated by control registers of the
processor when a control bit is set.