Fortran Programming Guide

Interactive Debugging With dbx and Sun WorkShop

The Sun WorkShop provides a tightly integrated development environment for building and browsing, as well as debugging applications written in Fortran, C, and C++.

The Sun WorkShop debugging facility is a window-based interface to dbx, while dbx itself is an interactive, line-oriented, source-level symbolic debugger. Either can be used to determine where a program crashed, to view or trace the values of variables and expressions in a running code, and to set breakpoints.

Sun WorkShop adds a sophisticated graphical environment to the debugging process that is integrated with tools for editing, building, and source code version control. It includes a data visualization capability to display and explore large and complex datasets, simulate results, and interactively steer computations.

For details, see the Sun manuals Using Sun WorkShop and Debugging a Program With Sun WorkShop, and the dbx(1) man pages.

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:

To debug optimized programs, use the dbx fix command to recompile the routines you want to debug:

  1. Compile the program with the appropriate -On optimization level.

  2. Start the execution under dbx.

  3. Use fix -g any.f without optimization on the routine you want to debug.

  4. Use continue with that routine compiled.

Some optimizations will be inhibited by the presence of --g on the compilation command. For example, --g suppresses the automatic inlining usually obtained with- -O4. --g cancels any parallelization option (--autopar, --explicitpar, --parallel), as well as --depend and --reduction. Debugging is facilitated by specifying --g without any optimization options. See the dbx documentation for details.