HP 3000 Manuals

Preparing the Program [ Symbolic Debugger/iX User's Guide ] MPE/iX 5.0 Documentation


Symbolic Debugger/iX User's Guide

Preparing the Program 

Before starting HP Symbolic Debugger, compile your HP COBOL II, HP
FORTRAN 77, HP Pascal, or HP C program using the symbolic debugger
option.  If you do not use the symbolic debugger option, you can only
debug the program in disassembly mode; the debugger can track only
register values, absolute addresses and labels.

When you're confident that the program will compile without errors, use
the symbolic debugger compile option.  When you use the symbolic debugger
option, the compiler generates tables containing the names and addresses
of variables, labels and source lines.  These tables are the symbolic
hooks into your program.

There are two ways to compile your program with symbolic debugger
information:

   *   Embed the symbolic debugger option in the first statement of your
       source code.

   *   Use the info-string option to specify the symbolic debugger option
       when you compile your program.

Table 3-1 lists the compiler embedded and info string options you can use
to prepare programs for use with HP Symbolic Debugger.

          Table 3-1.  Compiler Embedded and Info-string Options 

-----------------------------------------------------------------------------------------------
|                       |                                |                                    |
|       Compiler        |     Source Language Option     |        Info-string Argument        |
|                       |                                |                                    |
-----------------------------------------------------------------------------------------------
|                       |                                |                                    |
| HP COBOL II           | $control symdebug = xdb        | Info = "$control symdebug = xdb"   |
|                       |                                |                                    |
-----------------------------------------------------------------------------------------------
|                       |                                |                                    |
| HP FORTRAN 77         | $symdebug xdb|off              | Info = "symdebug xdb|off"          |
|                       |                                |                                    |
-----------------------------------------------------------------------------------------------
|                       |                                |                                    |
| HP Pascal             | $symdebug 'xdb'$               | Info = "symdebug 'xdb'"            |
|                       |                                |                                    |
-----------------------------------------------------------------------------------------------
|                       |                                |                                    |
| HP C                  | None                           | Info ="-g"                         |
|                       |                                |                                    |
-----------------------------------------------------------------------------------------------

When compiling and linking, you need to link the file xdbend.lib.sys with
the object files of your program.  Specify xdbend.lib.sys as the last
file in your link list.  xdbend.lib.sys provides space in the user
process for the debugger and is required.

The example below compiles and links the HP C program test1c producing
the executable object program TEST1P:

     :CCXL TEST1C, TEST1O;INFO="-g"
     :LINK FROM=TEST1O, XDBEND.LIB.SYS; TO=TEST1P; RL=LIBCINIT.LIB.SYS

For HP COBOL II programs only, HP Symbolic Debugger uses the listing file
cobxdb rather than the source files for the source viewing inside the
debugger.  Therefore, when you are debugging HP COBOL II programs derived
from more than one source file, you must equate the default listing file
cobxdb to a permanent listing file name before you compile each source
file.  You do not link the listing files with the object files.

For example, suppose you have an HP COBOL II program comprised of the
source files cob1 and cob2.  When you compile each file, use the xdb= 
parameter to name your listing file.  The following example compiles cob1 
into the object file cob1o, naming the listing file lcob1.

     :COB85XL COB1, COB1O; XDB=LCOB1

Do the same with each additional program file.

     :COB85XL COB2, COB2O; XDB=LCOB2

Alternatively, you can use the MPE file command to equate cobxdb to the
listing file name.  For example, to compile the same program files using
this method, start by equating cobxdb to the listing file name lcob1.

     :FILE COBXDB=LCOB1;SAVE

Then, compile cob1 into the object file named cob1o.  After compiling,
you should be able to see the file lcob1 when you do a listf.

     :COB85XL COB1, COB1O

When you are ready to compile the second source file, change the cobxdb 
file equation:

     :FILE COBXDB=LCOB2;SAVE

Then, compile cob2 into an object file named cob2o.  Again, you should be
able to see the file lcob2 when you perform a listf.

     :COB85XL COB2, COB2O

Repeat this procedure for each source file comprising the program.

Once you have compiled all your source files by using one of the two
previous methods, link the object files and the xdbend.lib.sys file
together into an executable file named cobx:

     :LINK FROM=COB1O, COB2O, XDBEND.LIB.SYS;TO=COBX

The debugger information in the object files know about the listing files
lcob1 and lcob2 so you do not need to link these files.  Once you've
linked your program, you are ready to start HP Symbolic Debugger.



MPE/iX 5.0 Documentation