HP 3000 Manuals

Using Debug [ HP COBOL II/XL Programmer's Guide ] MPE/iX 5.0 Documentation


HP COBOL II/XL Programmer's Guide

Using Debug 

Debug, the MPE XL System Debugger, allows you to analyze your program's
object code while it is executing.  With Debug, you can do the following:

   *   Display data item values.

   *   Change data item values and continue program execution.

   *   Set breakpoints at statements.

   *   Set breakpoints at data items.  You can cause the program to break
       when a specified data item changes value.


NOTE This section is not a Debug tutorial. It only explains how to obtain run-time addresses that you can use in Debug commands. For information on the Debug commands themselves, refer to the MPE XL System Debug Reference Manual.
While using Debug, you need the maps listed in Table 7-5 . Table 7-5. COBOL Maps ------------------------------------------------------------------------------------------------ | | | | | | Map | Contents of Map | Purpose of Map | How to Get the Map | | | | | | ------------------------------------------------------------------------------------------------ | | | | | | Symbol table | Data item offsets. | To display or change data | Compile your program with | | map | | item values and to set | control option MAP. | | | | breakpoints at data | | | | | items. | | | | | | | ------------------------------------------------------------------------------------------------ | | | | | | Verb map | Offsets of program | To set breakpoints at | Compile your program with | | | statements from | statements. | control option VERBS. | | | starting addresses in | | | | | link map. | | | | | | | | ------------------------------------------------------------------------------------------------ | | | | | | Link map | Actual starting | To set breakpoints at | Link Editor command | | | addresses. | statements if the program | LISTPROG. | | | | is in chunks, and to find | | | | | the addresses of OWN or | The information in the | | | | EXTERNAL data. | link map is also | | | | | available from Debug, | | | | | during program execution, | | | | | with the PROCLIST | | | | | command. See the section | | | | | "Link Map." | | | | | | ------------------------------------------------------------------------------------------------ This section does the following: * Explains the symbol table, verb, and link maps. * Gives an example of a chunked program and its maps. * Gives an example of nested and concatenated programs and their maps. * Explains how to get data and program offsets at run time. * Explains how to find subprogram parameters. * Explains register meanings. * Explains how to calculate the addresses of data items. * Explains how to calculate code addresses. * Explains how to debug trap errors with Debug. Symbol Table Map A symbol table map lists data item offsets and lengths. The offsets and lengths are in bytes, in hexadecimal representation. You need these offsets in order to display or change data item values or set breakpoints at data items. In a symbol table map, EXTERNAL items have the base EXT. Offsets are offsets from the address of the level 01 EXTERNAL item. To produce a symbol table map of your program, compile it with the control option MAP (see Chapter 6 ). Verb Map A verb map lists the offsets of the statements in your program. The offsets are in bytes, in hexadecimal representation. They are offsets from the entry point or chunk named in the heading of the verb map page. You need them in order to set breakpoints at statements. To produce a verb map of a COBOL program, compile it with the control option VERBS. When reading a verb map, remember that some code offsets are offset from the beginning of chunks. See "Maps Example for Chunked Program." Link Map A link map lists the following actual starting addresses, which you need in order to set breakpoints at statements and display data. A link map is one way to find the addresses of chunk entry points and OWN and EXTERNAL data. The other way is to use the PROCLIST command when you execute your program under Debug. * Starting addresses of chunks, if applicable. See "Maps Example for Chunked Program." Each chunk name that appears in the verb map is the starting address of a chunk. The code offsets in the verb map are offsets from the starting addresses of chunks. Compiler-generated chunk names are of the form program_name$nnn$. * Starting address of main program data storage (relative to DP). Other main program data addresses are offsets from this address. You do not need the link map for the main program. * Starting address of subprogram data storage (one per subprogram). For a subprogram compiled with the ANSISUB or SUBPROGRAM option, M$n$program_name (where n is a number) contains the starting address of the subprogram's OWN data. For a subprogram compiled with the DYNAMIC option, SP contains the ending address of the subprogram's data storage (a value that is only available while the subprogram is executing). Other subprogram addresses are offsets from this address. You can ignore other addresses. The link map also shows the program entry point. Refer to the Link Editor manual for the commands that produce a link map. Maps for Chunked Program For a large program, the executable code is in chunks. Each chunk is in a separate subspace, but they all reside in the same file. When reading a verb map and using Debug, code offsets are offset from the beginning of chunks. Chunk names are derived from the program-id, as explained in Chapter 4 . See "Calculating Code Addresses" to determine how to find code addresses of chunks. Example. The following compiler listing for a chunked program includes a verb map. The following is the compiler command for this example: :COB85XL NC101.PROG;INFO="$CONTROL VERBS" The following is the compiler listing: ********************************************************** * COB85XL - Compile COBOL program. * Object file will be $NEWPASS. ********************************************************** PAGE 0001 HP31500A.01.00 [85] (C) HEWLETT-PACKARD CO. 1987 00001 COBCNTL 001000* COBCNTL.PUB.SYS Defaults are: 00002 COBCNTL 002000*CONTROL LIST,SOURCE,NOCODE,NOCROSSREF,ERRORS=100, NOVERBS,WARN 00003 COBCNTL 003000*CONTROL LINES=60,NOMAP,MIXED,QUOTE=",NOSTDWARN, SYNC32,INDEX32 00004 INFO=$control verbs 00005 NC1014.1 000100 IDENTIFICATION DIVISION. 00006 NC1014.1 000200 PROGRAM-ID. 00007 NC1014.1 000300 NC101. : 02001 NC1014.1 200800 DIV-WRITE-57. 02002 NC1014.1 200900 MOVE "DIV-TEST-57" TO PAR-NAME. 02003 NC1014.1 201000 PERFORM PRINT-DETAIL. 02004 NC1014.1 201100 CCVS-EXIT SECTION. 02005 NC1014.1 201200 CCVS-999999. 02006 NC1014.1 201300 GO TO CLOSE-FILES. PAGE 0002/COBTEXT NC101 STATEMENT OFFSETS Entry = nc101 STMT OFFSET STMT OFFSET STMT OFFSET STMT OFFSET ... 261 3C 317 848 373 F44 428 15CC 262 40 318 860 374 F44 429 16A8 263 40 319 860 375 F6C 430 16B4 264 74 320 890 376 F84 431 16C4 265 BC 321 8A4 377 F84 432 16CC 266 D0 322 8B4 378 10C0 433 16CC 267 E4 323 8E8 379 10F0 434 16E0 268 EC 324 918 380 10F8 435 16E8 : 1401 9470 1444 9988 1487 A0E4 1530 A4E8 1402 949C 1445 998C 1488 A0EC 1531 A514 1403 94B4 1446 998C 1489 A0F4 1404 94B4 1447 99B8 1490 A0F4 1405 94C4 1448 99D0 1491 A0F4 PAGE 0008/COBTEXT NC101 STATEMENT OFFSETS Chunk = nc101$001$ STMT OFFSET STMT OFFSET STMT OFFSET STMT OFFSET ... 1532 8 1587 72C 1642 FEC 1697 1608 1533 8 1588 738 1643 FEC 1698 1610 1534 20 1589 73C 1644 1010 1699 1610 1535 3C 1590 92C 1645 102C 1700 1640 : 1978 3C4C 1987 3D98 1996 3E50 2005 3F80 1979 3C54 1988 3DB0 1997 3E18 2006 3F80 1980 3C84 1989 3DB0 1998 3F2C
NOTE The verb map on PAGE 0002 through PAGE 0008 is due to the control option VERBS. Notice the entry name nc101 on PAGE 0002 and the chunk name nc101$001$ on PAGE 0008. Offsets are offsets from the addresses under SYM VALUE in the link map.
PAGE 0011/COBTEXT NC101 COBOL ERRORS and WARNINGS COBOL ERRORS: LINE # SEQ # COL ERROR SEV TEXT OF MESSAGE ------ ------ --- ----- --- --------------- 00957 096400 80 050 W ARITHMETIC OVERFLOW MAY OCCUR. 00973 098000 80 050 W ARITHMETIC OVERFLOW MAY OCCUR. 00989 099600 80 050 W ARITHMETIC OVERFLOW MAY OCCUR. 01005 101200 80 050 W ARITHMETIC OVERFLOW MAY OCCUR. 0 ERRORS, 0 QUESTIONABLE, 4 WARNINGS DATA AREA IS 9FC BYTES. CPU TIME = 0:01:20. WALL TIME = 0:06:19. END OF PROGRAM END OF COBOL COMPILATION The following shows a Link Editor session that displays the link map of the chunked program: :LINK $OLDPASS;MAP[REV BEG] HP Link Editor/XL (HP30315A.02.27) Copyright Hewlett-Packard Co 1986 LinkEd> link $OLDPASS;MAP PROGRAM : $OLDPASS XL LIST : CAPABILITIES : BA, IA NMHEAP SIZE : NMSTACK SIZE : VERSION : 85082112 Sym C H X P Sym Sym Sym Lset Name Type Scope Value Name ---- - - - - ---- ----- ----- ---- $START$ 0 3 3 sec_p univ 00009A74 _start 0 3 3 sec_p univ 0000AF68 NC101 nc101 0 3 3 pri_p univ 0000AF4C NC101 $RECOVER_END 0 code univ 0001AF4C $RECOVER_START 0 code univ 0001ADD8 $START$ 0 code univ 00009A90 $UNWIND_END 0 code univ 0001ADB8 $UNWIND_START 0 code univ 0001A4F8 _start 0 code univ 0000B044 NC101 nc101 0 code univ 0000B044 NC101 nc101$001$ 0 code univ 00016094 NC101 M$1 0 data local dp+00000000 . . . [REV END] The entry names nc101 and nc101$001$ are identifiable by the type code under SYM TYPE.


MPE/iX 5.0 Documentation