Sun Studio provides a tightly integrated development environment for debugging applications written in Fortran, C, and C++.
The dbx program provides event management, process control, and data inspection. You can watch what is happening during program execution, and perform the following tasks:
Fix one routine, then continue executing without recompiling the others
Set watchpoints to stop or trace if a specified item changes
Collect data for performance tuning
Monitor variables, structures, and arrays
Set breakpoints (set places to halt in the program) at lines or in functions
Show values—once halted, show or modify variables, arrays, structures
Step through a program, one source or assembly line at a time
Trace program flow—show sequence of calls taken
Invoke procedures in the program being debugged
Step over or into function calls; step up and out of a function call
Run, stop, and continue execution at the next line or at some other line
Save and then replay all or part of a debugging run
Examine the call stack, or move up and down the call stack
Program scripts in the embedded Korn shell
Follow programs as they fork(2) and exec(2)
To debug optimized programs, use the dbx fix command to recompile the routines you want to debug:
Compile the program with the appropriate -On optimization level.
Start the execution under dbx.
Use fix -g any.f without optimization on the routine you want to debug.
Use continue with that routine compiled.
Some optimizations will be inhibited by the presence of -g on the compilation command. See the dbx documentation for details.
For details, see the Sun Studio Debugging a Program With dbx manual, and the dbx(1) man pages.