Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
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 Linux terminal window or a Windows command prompt, such as the Intel oneAPI command prompt available from the oneAPI program folder, compile and link the program with full debug information and no optimization:

    Linux

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

    
    ifx -g -O0 file.f90

    Windows

    On Windows, specify the debug compiler option with keyword full and option /Od to create unoptimized code and provide the symbol table and traceback information needed for symbolic debugging

    
    ifx /debug:full /Od file.f90

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 Debug the Squares Example Program.

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