HP 3000 Manuals

HOW TO CALL STACKDUMP [ MPE Debug/Stack Dump Reference Manual ] MPE/iX 5.0 Documentation


MPE Debug/Stack Dump Reference Manual

HOW TO CALL STACKDUMP 

The parameters used for STACKDUMP are defined in section II. If no
parameters are specified no dump is taken so it is usual to set
parameters.

The first parameter specifies the filename where the information is to be
dumped.  If this parameter is omitted, the dump is sent to the standard
list device, for a job, the line printer and in a session, your terminal.

If you do specify a filename and plan to collect your dump from a pile of
line printer output, you may want to include the second parameter that is
an integer printed on the dump to identify it.  Also, if you are making
several calls to STACKDUMP within a program, you can use this parameter
to differentiate between the resulting dumps.  It is also useful if you
have several consecutive versions of the program in order to document the
changes.

The third parameter can be used to suppress the ASCII conversion that is
otherwise printed automatically beside the octal dump.  It can also be
used to suppress the trace and stack analysis normally provided with the
dump.

The fourth parameter allows you to select the portion of the stack you
want dumped.  Actually, you can dump the entire stack from DB to S by
specifying a positive count relative to DB. If the count is greater than
the number of words in your stack, the dump terminates when it has
displayed the top of the stack.

Figure 4-3 illustrates a sample FORTRAN program that calls STACKDUMP in
order to dump the stack in an upward direction relative to DB. Since
STACKDUMP is a system intrinsic, it should be declared in a SYSTEM
INTRINSIC declaration (see item 1, Figure 4-3).  The call itself is shown
in item 6, Figure 4-3.  The first parameter specifies the file to which
the dump is sent, STDUMP, and the fourth parameter specifies the name of
the array containing the area to be dumped.  The filename is contained in
a byte array declared in the program as an 8-character array (see item 2,
Figure 4-3).  The contents of this array, the filename, is specified in a
DATA statement (see item 3, Figure 4-3).

The array, S, containing the select parameter value is declared in item
4, Figure 4-3 to have three double-word values.  These values for S are
defined in a DATA statement (see item 5, Figure 4-3).  Only the first two
double words are given values; the second word contains the terminator
for the array:  zero in the first word and - I in the second.  This value
is specified as an octal integer 177777.  Double word constants in
FORTRAN must be terminated by the letter J to indicate to the compiler
that they contain 32 bits.  Only the second word need be specified; the
first word is set to all zeros automatically.  The first double word of
the array specifies the count and that the count is to be relative to
DB+0.  When specifying a count relative to DB, the mode is zero.  For
this reason, only the count need be specified; zero in the first word is
relative to DB since the initial zeros in the second word indicate that
the mode is DB relative.

     :FORTRAN DBTESTST

     PAGE 0001           HP32102B.00.0

     00001000         $CONTROL MAP* LABEL,LOCATI ON, USLINIT
     00015      00002000               PROGRAM MAIN
     00015      00003000               SYSTEM INTRINSIC STACKDUMP -- 1 
     00015      00004000               CHARACTER*8 C,CI,C2(3)
     00015      00005000               CHARACTER*8 STDUMP -- 2 
     00015      00006000               INTEGER*4 S(3) -- 4 
     00015      00007000               COMMON I4,I5
     00015      00008000               DATA    S/l00J,%177777J/ -- 5 
     00015      00009000               DATA    C/"DBTEST1"/
     00015      00010000               DATA    C1 /"MAINPROG"/,C2/"MONE", "MTWO","MTHREE"/
     00015      00011000               DATA    STDUMP/"STDUMP"/ -- 3 
     00015      00012000               DATA    I6/10000/,I7/700/,I8/800/
     00015      00013000      10       DISPLAY C1,C2
     00034      00014000               I1 =   - 1
     00036      00015000               I2  =   1
     00040      00016000               I3 =    10
     00042      00017000               I4  =   100
     00044      00018000               I5  =   1000
     00046      00019000               CALL    STACKDUMP (STDUMP,,,S) -- 6 
     00054      00020000               DISPLAY "CALLING SUBROUTINE"
     00106      00021000      20       CALL    SUBROUT (C1,C2,I1,I2,I3)
     00116      00022000               DISPLAY "BACK FROM SUBROUTINE"
     00150      00023000               STOP
     00151      00024000               END
        SYMBOL  MAP

     NAME                   TYPE             STRUCTURE           ADDRESS

     C                      CHARACTER        SIMPLE      VAR     Q+   2,I
     C1                     CHARACTER        SIMPLE      VAR     Q+   3,I
     C2                     CHARACTER        ARRAY               Q+   3,I
     I1                     INTEGER          SIMPLE      VAR     Q+   8 -- 7 
     I2                     INTEGER          SIMPLE      VAR     Q+   9
     I3                     INTEGER          SIMPLE      VAR     Q+  10
     I4                     INTEGER          SIMPLE      VAR          0 COMMON
     I5                     INTEGER          SIMPLE      VAR          I COMMON
     I6                     INTEGER          SIMPLE      VAR     Q+   5,I
     I7                     INTEGER          SIMPLE      VAR     Q+   6,I
     I8                     INTEGER          SIMPLE      VAR     Q+   7,I
     S                      INTEGER*4        ARRAY               0+   1,I
     STACKDUMP              SUBROUTINE
     STDUMP                 CHARACTER        SIMPLE      VAR     Q+   4,I
     SUBROUT                                 SUBROUTINE

        COMMON BLOCKS

     NAME                    LENGTH

     COM'                      2

         LABEL   MAP

         STATEMENT     CODE     STATEMENT     CODE       STATEMENT    CODE
           LABEL      OFFSET      LABEL       OFFSET       LABEL      OFFSET

            10          15          20          106

          Figure 4-3.  Sample FORTRAN Program Using STACKDUMP 

If you want to select a dump relative to S, you must specify the first
three bits of the second word as octal 7 (bits 0 through 2= 111).  To do
this, use a composite format as shown below:

       DATA S/%[16/0,3/7,13/100]J,%177777J/
                \--/ \-/ \----/
                  |   |     |- count = 100
                  |   |
                 S-0  mode = 111

The brackets allow you to indicate bit values within the word.  As with
the previous example, the terminator is specified as a double-word octal
value 177777.



MPE/iX 5.0 Documentation