Preparing Your Program for Debugging

This section describes preparing your program for debugging:

To prepare your program for debugging when using the visual development environment:

  1. Start the visual development environment (click Developer Studio in the Compaq Visual Fortran program folder).

  2. Open the appropriate Workspace (File menu, either Open Workspaces or Recent Workspaces).

  3. Click the FileView pane.

  4. To edit the source file to be debugged, double-click on the file name.

  5. Click the Project name. The screen might appear as follows (the ClassView tab only appears if Visual C++ is also installed):

    visual development environment after opening a workspace and fortran source file

  6. In the Build menu, click Set Active Configuration and select the debug configuration.

  7. To check your project settings for compiling and linking, in the Project menu, click Settings, then click the Fortran tab. Similarly, to check the debug options set for your program (such as program arguments or working directory), click the Debug tab in the Project Settings dialog box.

  8. To compile your program:

  9. Eliminate any compiler diagnostic messages in the text editor and recompile if needed.

  10. To build your application, in the Build menu, click Build file.EXE.

  11. Set breakpoints in the source file and debug the program, as described in Debugging the Squares Example Program.

To prepare your program for debugging when using the command line (DF command):

  1. Correct any compilation and linker errors.
  2. In a command window (such as the Fortran command window available from the Visual Fortran program folder), compile and link the program with full debug information and no optimization:
     DF /debug:full /nooptimize file.f90
    
  3. Start the visual development environment.
  4. In the File menu, click the Open Workspace item. Specify the file name of the executable (.EXE) file to be debugged.
  5. In the File menu, click Open. Specify the name of the source file (such as .F90 or .FOR) that corresponds to the file being debugged. The text editor window appears. Your screen might appear as follows:

    opening a fortran source file
  6. Set breakpoints in the source file and debug the program, as described in Debugging the Squares Example Program.

To add Source Browser Information to your debug configuration, see Source Browser Information for a Configuration.