HP 3000 Manuals

ANALYZING THE STACK DUMP [ MPE Debug/Stack Dump Reference Manual ] MPE/iX 5.0 Documentation


MPE Debug/Stack Dump Reference Manual

ANALYZING THE STACK DUMP 

When the program shown in Figure 4-3 is executed, a stack dump is taken
just prior to location 54 in the listing.  (The starting code location
for this program unit MAIN is the same as that shown in the PMAP in
Figure 3-2.)  The trace and stack analysis shows the current program
location to be at 240, or 165+53 (octal).  (Refer to Figure 4-4 for the
printout resulting from execution of STACKDUMP.)

Since DB+100 was out of the bounds of the program's stack, the dump
stopped at location 72 (the location of S) and a message is printed.  The
value of Q prior to the stack dump is shown in the second line of the
listing.  The value of Q after the stack dump is four words greater than
the top of the stack to allow four words for the stack markers.  This Q
value is shown in the first line of the trace and stack analysis.

Figure 4-4 shows how to determine Q and S from the trace and stack
analysis.  Once you know where these values are and that the dump starts
with DB+ 0, you can locate all the values shown in the symbol map in
Figure 4-3.  For example, look at the location Q+ 8 in the symbol map
(item 7, Figure 4-3).  This location contains the integer simple variable
11 that has been set to - 1 in the program.  Then look at the location Q+
8 in the stack dump and you will see that it correctly contains the value
177777 (octal).

The character values in C, C 1, and C2 are found indirectly through the
byte addresses stored in Q+2 and Q+3.  Note that Q+2 contains the value
20 and Q+3 the value 30.  Since these are byte addresses, they indicate
that C starts in the 2Oth byte or word 10 and that C1, which is word zero
of the array C2, starts in the 30th byte or word 14.  Remember that all 
numbers shown in the dump are octal.

All other program values set when the dump was taken can be ascertained
in this way.


NOTE Before running a program in which a call to STACKDUMP specifies a filename, be sure to equate the file name to a device where you want the dump sent. Otherwise the dump is sent to a null file.
:FILE STDUMP=$STDLST :RUN DBPROGST MAINPROG MONE MTWO MTHREE *** STACK DISPLAY *** ------------------- S=000072 DL=177602 Z=001507 | Q=000076 P=000240 LCST= 000 STAT=U,1,1,L,0,0,CCG X=000000 | | Q=000053 P=177777 LCST= S132 STAT=P,I,0,L,0,0,CCG X=000000 | ^ | |------------------------------------------- | | | ..DB.. OCTAL | ASCII | 00000 000043 000044 000000 000144 | .# .$ .. .D | 00004 000000 177777 000000 000000 | .. .. .. .. | 00010 042102 052105 051524 030441 | DB TE ST 1 | 00014 046501 044516 050122 047507 | MA IN PR OG | 00020 046517 047105 020040 020040 | MO NE | 00024 046524 053517 020040 020040 | MT WO | 00030 046524 044122 042505 020040 | MT HR EE | 00034 051524 042125 046520 020040 | ST DU MP | 90040 023420 001274 001440 000144 | '. .. . .D | 00044 001750 003003 177777 000000 | .. .. .. .. | 00050 000000 000000 140033 000004 <- Q .. .. .. .. | 00054 000000 000020 000030 000070 .. .. .. .8 | 00060 000040 000041 000042 177777 <- . .! ." .. | 00064 000001 000012 000070 000110 | .. .. .8 .H | 00070 000000 000002 <--- S-0 | .. .. | ** AREA OUT OF BOUNDS ** ^ | | | Q+8 |------------------------------- CALLING SUBROUTINE SUBROUT SBONE SBTWO SBTHREE RETURNING TO MAIN PROGRAM BACK FROM SUBROUTINE END OF PROGRAM : Figure 4-4. Sample Stack Dump


MPE/iX 5.0 Documentation