Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt
There are various debugging options that can be specified when compiling to create a program that contains additional information about the source code. This allows debugging software to provide this information and give context as the program is analysed.

...

Column


Panel
titleOn this Page


Table of Content Zone

Table of Contents

Column
width900px
Note
This page describes options for CPU debugging. For GPU debugging options refer to Debugging GPU-Enabled Software.




Prerequisite knowledge

To start using debugging options you should first be familiar with how to install and run your program and how to set compiler flags when compiling.


Column
width900px


Note
This page describes options for CPU debugging. For GPU debugging options refer to Debugging GPU-Enabled Software.


Symbolic debugging

When an application crashes or stalls, you can use a debugger to help locate the cause and enable further investigation. Enabling support for symbolic debugging generates and stores source-level debugging and symbol information in the executable. This enables a debugger to reference variables by name and show where in the source code the problem is.

...

Column

Table 4. Cray Fortran compiler debugging options

FlagDescription
-G0 Full debugging information with most optimisations disabled.
-G1Most debugging information is available with partial optimization. Some optimizations make tracebacks and limited breakpoints available in the debugger. Some scalar optimizations and all loop nest restructuring is disabled, but the source code will be visible and most symbols will be available. This allows block-by-block debugging, with the exception of innermost loops. The executable will be faster than with -g or -G0.
-G2 Partial debugging information. Most optimizations, tracebacks and very limited breakpoints are available in the debugger. The source code will be visible and some symbols will be available. This level allows post-mortem debugging, but local information such as the value of a loop index variable is not necessarily reliable at this level because such information often is carried in registers in optimized code. The executable will be faster and smaller than with -G1.
-rd Decompiles (translates) the intermediate representation of the compiler into listings that resemble the format of the source code. You can use these files to examine the restructuring and optimization changes made by the compiler, which can lead to insights about changes you can make to your Fortran source to improve its performance.


AMD AOCC compilers

The AMD AOCC C/C++ compilers are based on LLVM Clang compilers and so have the same options as the Cray compilers.

...

Most compilers support checking for various error conditions at run time, such as out-of-bounds array access.


Column


Warning

Runtime checks can degrade performance so use these options only for debugging.


...