HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
This section provides an introduction to using the OpenVMS debugger with HP COBOL programs. It includes the following:
For complete reference information on the OpenVMS debugger,
refer to the OpenVMS Debugger Manual in the OpenVMS documentation set.
Online help is immediately available to you during a
debugging session when you type the HELP command at the debugger prompt
(DBG>).
C.3.1 Notes on HP COBOL Support
In general, the OpenVMS debugger supports the data types and operators of HP COBOL and other debugger-supported languages. However, there are important language-specific limitations. (To get information about the supported data types and operators for a language, type the HELP LANGUAGE command at the DBG> prompt.)
The debugger shows source text included in a program with the COBOL COPY file statement or the COPY module of library statement. However, the debugger does not show text which was created with the COPY REPLACING or REPLACE statement, or included by the COPY text FROM DICTIONARY statement.
The debugger cannot show the original source lines associated with the
code for a REPORT section. You can see the DATA SECTION source lines
associated with a report, but no source lines are associated with the
compiled code that generates the report.
C.3.2 Notes on Debugging Optimized Programs (Alpha, I64)
The HP COBOL compiler is a highly optimizing compiler. Several of the optimizations it performs, such as instruction scheduling and label deletion, can cause unexpected behavior in the OpenVMS Debugger.
Instruction scheduling can make the debugger appear to execute statements out of order. A single COBOL source statement can often result in several machine instructions. A RISC architecture machine, like the Alpha processor, can start working on a new instruction every machine cycle, but not all instructions can complete within one machine cycle. If the output from one machine instruction is used as the input to a subsequent machine instruction, the machine cannot begin processing the second instruction until it has finished processing the first. In many cases an entirely separate instruction can execute in parallel with the first instruction to perform a related computation.
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 HP COBOL compiler optimizations,
Hewlett-Packard 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
HP COBOL optimizations. In particular it suppresses most
instruction scheduling and all label deletion optimizations.
C.3.3 Sample Debugging Session (Alpha, I64)
The following OpenVMS Alpha and I64 debugging session does not show the location of program errors; it is designed to show only the use of debugger features.
$ COBOL/DEBUG/NOOPTIMIZE TESTA $ LINK/DEBUG TESTA |
$ RUN TESTA OpenVMS Alpha DEBUG Version V7.1-000 %DEBUG-I-INITIAL, Language: COBOL, Module: TESTA %DEBUG-I-NOTATMAIN, type GO to get reach MAIN program DBG> |
DBG> GO break at routine TESTA 11: DISPLAY "ENTER WORD" |
DBG> SET BREAK %LINE 43 |
DBG> GO ENTER WORD: |
abc break at TESTA\TESTB\%LINE 43 43: PERFORM LOOK-BACK VARYING SUB-1 FROM 20 BY -1 |
DBG> SET BREAK %LINE 47 DBG> SET BREAK %LINE 50 DO (EXAMINE HOLD-CHARS;EXAMINE SUB-1;GO) |
DBG> SHOW BREAK breakpoint at TESTA\TESTB\%LINE 43 breakpoint at TESTA\TESTB\%LINE 47 breakpoint at TESTA\TESTB\%LINE 50 do (EXAMINE HOLD-CHARS;EXAMINE SUB-1;GO) |
DBG> TYPE 43:50 module TESTA 43: PERFORM LOOK-BACK VARYING SUB-1 FROM 20 BY -1 44: UNTIL TEMP_CHAR (SUB-1) NOT = SPACE. 45: MOVE SUB-1 TO CHARCT. 46: PERFORM MOVE-IT VARYING SUB-2 FROM 1 BY 1 UNTIL SUB-1 = 0. 47: MOVE HOLD-WORD TO TEMP-WORD. 48: MOVE-IT. 49: MOVE TEMP-CHAR (SUB-1) TO HOLD-CHAR (SUB-2). 50: SUBTRACT 1 FROM SUB-1. |
DBG> SET TRACE %LINE 15 |
DBG> SET WATCH DISP-COUNT DEBUG-I-WPTTRACE, non-static watchpoint, tracing every instruction |
DBG> GO break at TESTA\TESTB\%LINE 50 50: SUBTRACT 1 FROM SUB-1. TESTA\TESTB\HOLD-CHARS: CHARS: "c " TESTA\TESTB\SUB-1: 3 break at TESTA\TESTB\%LINE 50 50: SUBTRACT 1 FROM SUB-1. TESTA\TESTB\HOLD-CHARS CHARS: "cb " TESTA\TESTB\SUB-1: 2 break at TESTA\TESTB\%LINE 50 50: SUBTRACT 1 FROM SUB-1. TESTA\TESTB\HOLD-CHARS CHARS: "cba " TESTA\TESTB\SUB-1: 1 break at TESTA\TESTB\%LINE 47 47: MOVE HOLD-WORD TO TEMP-WORD. DBG> |
DBG> EXAMINE SUB-1 TESTA\TESTB\SUB-1: 0 |
DBG> DEPOSIT SUB-2 = -42 |
DBG> EXAMINE SUB-2 TESTA\TESTB\SUB-2: -42 |
Previous | Next | Contents | Index |