UW AMath High Performance Scientific Computing
 
AMath 483/583 Class Notes
 
Spring Quarter, 2011

Table Of Contents

Previous topic

Debugging and debuggers

Next topic

Fortran Software Packages

This Page

Fortran debugging

For some general tips on writing and debugging programs in any language, see Debugging and debuggers.

Compiling with various gfortran flags

There are a number of flags you can use when compiling your code that will make it easier to debug.

Here’s a generic set of options you might try:

$ gfortran -g -W -Wall -fbounds-check -pedantic-errors \
      -ffpe-trap=zero,invalid,overflow,underflow  program.f90

See Useful gfortran flags for more information. Most of these options indicate that the program should give warnings or die if certain bad things happen.

Compiling with the -g flag indicates that information should be generated and saved during compilation that can be used to help debug the code using a debugger such as gdb or totalview. You generally have to compile with this option to use a debugger.

The gdb debugger

This is the Gnu open source debugger for Gnu compilers such as gfortran. Unfortunately it works very poorly for Fortran.

Totalview

Totalview is a commercial debugger that works quite well on Fortran codes together with various compilers, including gfortran. It also works with other languages, and for parallel computing.

See Rogue Wave Softare – totalview family.