Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Prepare Your Program for Debugging

This section describes preparing your program for debugging.

Prepare to Debug Using the Command Line

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

  1. Correct any compilation and linker errors.

  2. In a command window, such as the Fortran command window available from the Intel® Fortran program folder, compile and link the program with full debug information and no optimization:

    Linux*

    
    ifort -g file.f90

    Windows*

    
    ifort /debug:full file.f90

On Linux, specify the g compiler option to create unoptimized code and provide the symbol table and traceback information needed for symbolic debugging. The notraceback option cancels the traceback information.

On Windows, specify the debug compiler option with keyword full to produce full debugging information. It produces symbol table information needed for full symbolic debugging of unoptimized code and global symbol information needed for linking.

Prepare to Debug Using Visual Studio*

The following applies to Windows* operating systems only.

To prepare your program for debugging when using the integrated development environment (IDE):

  1. Start the IDE (select the appropriate version of Visual Studio* in the program folder).

  2. Open the appropriate solution (using the Solution menu, either Open Solution or Recent Projects).

  3. Open the Solution Explorer View.

  4. To view the source file to be debugged, double-click on the file name. The screen resembles the following:



  5. In the Build menu, select Configuration Manager and select the Debug configuration.

  6. To check your project settings for compiling and linking, select the project name in Solution Explorer . Now, in the Project menu, select Properties , then click the Fortran folder in the left pane. Similarly, to check the debug options set for your project (such as command arguments or working directory), click the Debugging folder in the Property Pages dialog box.

  7. To build your application, select Build > Build Solution.

  8. Eliminate any compiler diagnostic messages using the text editor to resolve problems detected in the source code and recompile if needed.

  9. Set breakpoints in the source file and debug the program. For more information, see Debugging the Squares Example Program.

NOTE:
You must set a breakpoint before starting the program, otherwise the program will run to completion, and exit.