Compaq COBOL AAQ2G1FTK User Manual

Page 573

Advertising
background image

Programming Productivity Tools

C.4 OpenVMS Debugger (OpenVMS)

During instruction scheduling, instructions are reordered to minimize waiting
time. As a result an instruction resulting from a subsequent COBOL statement
can be scheduled in the middle of (or even before) a sequence of instructions
from a preceding statement. This reordering NEVER changes the meaning of
your program, but it can make your program’s execution in the debugger seem
incorrect. The most common symptom of instruction scheduling is that the
pointer in the debugger source window jumps back and forth between lines when
you use the debugger STEP command.

When the compiler performs label deletion, it deletes paragraph and section
labels that you do not explicitly reference in your source program. This prevents
you from setting breakpoints on the affected labels which can make the analysis
and optimization of your program more difficult.

Because of these and other Compaq COBOL compiler optimizations, Compaq
recommends that you use the /NOOPTIMIZE qualifier in conjunction with
the /DEBUG qualifier when you are debugging your COBOL programs. Using
/NOOPTIMIZE qualifier disables most of the Compaq COBOL optimizations.
In particular it suppresses most instruction scheduling and all label deletion
optimizations.

The following OpenVMS Alpha debugging session does not show the location of
program errors; it is designed to show only the use of debugger features.

1.

The following example shows how to compile and link a Compaq COBOL
program consisting of a single compilation unit named TESTA.

$ COBOL/DEBUG/NOOPTIMIZE TESTA
$ LINK/DEBUG TESTA

The /DEBUG qualifier on the COBOL command causes the compiler to write
the debug symbol records associated with TESTA into the object module,
TESTA.OBJ. These records allow you to use the names of variables and other
symbols declared in TESTA in debugger commands. (If your program has
several compilation units, you must compile each unit that you want to debug
with the /DEBUG qualifier.)

The /NOOPTIMIZE qualifier on the COBOL command disables default
optimization for debugging. Because Compaq COBOL is, by default, a highly
optimizing compiler, you will notice unusual and confusing program execution
when you step through an optimized program with the debugger.

The /DEBUG qualifier on the LINK command causes the linker to include all
symbol information that is contained in TESTA.OBJ in the executable image.
The qualifier also causes the image activator to start the debugger at run
time. (If your program has several object modules, you might need to specify
other modules in the LINK command.)

2.

The RUN command starts the session. If you compile and link the program
with /DEBUG, you do not need to use the /DEBUG qualifier in the RUN
command.

When you give the RUN command, the debugger displays its standard
header, showing that the default language is COBOL and the default scope
and module are your main program. The debugger returns control with the
prompt, DBG>.

Programming Productivity Tools C–9

Advertising