HP Fortran Programmer's Guide (March 2010)

Debugging
Using the HP WDB debugger
Chapter 4 123
Using the HP WDB debugger
The HP WDB debugger is the primary tool for debugging HP Fortran programs. The
debugger provides such basic debugging functions as program control, process control,
program and data monitoring, and expression evaluation. The debugger has both a graphical
interface and a line-mode interface.
The debugger software includes different managers that enable it to handle different source
languages, target machines, object file formats, and user formats. The Fortran language
manager allows you to use Fortran syntax when entering expressions on the debugger
command line.
Before beginning a debugging session, you must compile the program with the -g compile-line
option. If you compile and link separately, you must use the -g option on both command lines.
The option causes the compiler to generate additional information needed by the debugger
and to insert it into the output code.
After compiling your program with the -g option, invoke the debugger with the wdb command,
supplying the name of the executable as an argument. For example, the following command
compiles prog.f90 for debugging:
$ f90 -g prog.f90 -o db_prog
Here is the command to start debugging the executable program:
$ wdb db_prog
You can use the debugger to debug code that has been optimized at levels 0, 1, and 2. To
debug optimized code, compile the program with both the -g and +Oopt-level options, where
opt-level is 0, 1, or 2. The following command line prog.f90 at optimization level 2 and
prepares for debugging:
$ f90 +O2 -g prog.f90 -o db_prog
Compiling with the -g option increases the size of both the object file and the executable file.
After you have debugged your program and are ready to build the production version, you
may want to recompile without the -g option.
For complete information about HP WDB debugger, refer to http://www.hp.com/go/wdb.
Printed and online documentation are available at this site.