Compaq AAQ2G1FTK Marine Radio User Manual


 
Programming Productivity Tools
C.3 Ladebug Debugger (Tru64 UNIX)
this section is available in the man page. For example, you can type
man cobol
,
and page to the appropriate topic to read information about the flags (
-g
,
-o
) used
at the beginning of the example in this section.
1. To begin this example you compile a Compaq COBOL program consisting of
the single compilation unit named TESTA.
% cobol -g -o testa testa.cob
cobol: Warning: file not optimized; use -g3 for debug with optimize
%
The
-g
switch on the compiler command causes the compiler to write the
debugger symbol table associated with the program into the executable
program.
Normally, the compiler turns off optimization when you specify
-g
and gives a
warning to that effect. To debug your program with full optimization turned
on, use the
-g3
switch.
2. The
ladebug
command starts the session. You provide your program name as
a parameter (argument) to the command. After the debugger reads in your
program’s symbol table, it returns control with its prompt,
(ladebug)
.
% ladebug testa
Welcome to the Ladebug Debugger Version 2.0.8 eft
------------------
object file name: testa
Reading symbolic information ...done
(ladebug)
3. Set a breakpoint. In this case, you wish to break at line 43 of your program.
(ladebug) stop at 43
[#2: stop at "testa.cob":43 ]
4. Begin execution with the
run
command. The debugger starts program
TESTA, prompts for a keyboard entry, and waits for a response.
(ladebug) run
ENTER WORD
5. Enter the word to be reversed. Execution continues until the image reaches
the breakpoint at line 43 of the contained program.
abc
[2] stopped at [TESTB:43 0x120001aa4]
43 PERFORM LOOK-BACK VARYING SUB-1 FROM 20 BY -1
6. Set two breakpoints. You can give the debugger a list of commands to execute
at breakpoints; the commands are entered in braces ( {} ).
(ladebug) stop at 47
[#2: stop at "testa.cob":47 ]
(ladebug) when at 50 { print chars of hold-chars; print SUB-1; cont; }
[#3: when at "testa.cob":50 { print CHARS of HOLD-CHARS; print SUB-1; ; cont ; } ]
7. Display the active breakpoints.
(ladebug) status
#1 PC==0x120001e14 in testa "testa.cob":2 { break }
#2 PC==0x120001ba4 in TESTB "testa.cob":47 { break }
#3 PC==0x120001c1c in TESTB "testa.cob":50
{ ; print CHARS of HOLD-CHARS; print SUB-1; ; cont ; ; }
Programming Productivity Tools C5