Sun Studio 12: Thread Analyzer User's Guide

3.3.1 Compile the Source Code

Compile your code and be sure to specify -g. Do not specify a high-level of optimization because information such as line numbers and callstacks, may be reported incorrectly at a high optimization level. Compile an OpenMP program with -g -xopenmp=noopt, and compile a POSIX threads program with just -g -mt.

See cc.1, CC.1, or f95.1 for more information.