INTERACTIVE USE OF SETDUMP [ MPE Debug/Stack Dump Reference Manual ] MPE/iX 5.0 Documentation
MPE Debug/Stack Dump Reference Manual
INTERACTIVE USE OF SETDUMP
If you enter the :SETDUMP command before running your program or if the
SETDUMP intrinsic is included in a program run interactively, control
transfers to DEBUG if the program terminates abnormally. A stack trace
analysis is displayed and then the program enters DEBUG mode so that you
can enter any of the DEBUG commands described in Section III. Any SETDUMP
parameters are ignored.
NOTE If a program aborts in the system SL only the stack marker trace
will be given. You will not enter DEBUG (in the interactive case)
nor will there be a STACKDUMP in JOBS. This is done for security
reasons.
USING :SETDUMP COMMAND INTERACTIVELY
To illustrate the use of :SETDUMP in interactive mode, suppose you are
running program DBPROG2 for the first time. You can precede the :RUN
command by a :SETDUMP command and, if the program aborts, you can then
use DEBUG to determine the cause and possibly correct it. In the example
in Figure 4-1, DBPROG2 terminates with an integer overflow.
The status of the aborted program in the example shows that the user
traps are set (bit 2=1). As a result, the overflow bit (bit 4) is not
set even though an overflow occurred. This is a result of the way the
interrupt system operates.
Following the stack analysis, the DEBUG prompt is issued. In response,
you can perform any of the standard DEBUG operations. For instance, if
you simply want to bypass the erroneous statement, you can increment the
P register and continue. Or you might want to terminate by entering E@ .
You can also display the contents of the instruction where the program
terminated and try to determine the cause of the error. Since the error
in this case is an integer overflow, you could look at the contents of
the last three or four words in the stack when the error occurred.
Usually, you will also look at your compilation listing. For this sample
program, the listing of program MAIN is shown in Figure 4-2; the listing
for SUBROUT and the PMAP listing from preparation are identical to those
shown in Figure 3-1 in Section III since only program MAIN has been
changed.
:FORTRAN DBTEST2
PAGE 0001 HP32102B.00.0
00001000 $CONTROL MAP, LABEL,LOCATION,USLINIT
00012 00000200 PROGRAM MAIN
00012 00003000 CHARACTER*8 C,C1,C2(3)
00012 00004000 COMMON I4, I5
00012 00006000 DATA C/"DBTEST1"/
00012 00007000 DATA C1 /"MAI NPROG"/, C2/"MONE", "MTWO", "MTHREE"/
00012 00008000 DATA I6/ 1 0000 /,I7/700/,I8/800 /
00012 00009000 10 DISPLAY Cl,C2
00031 00010000 I1 = -1
00033 00011000 I2 = 1
00035 00012000 I3 = 10
00037 00013000 I4 = 100
00041 00014000 I5 = 1000
00043- 1 00014100 I5=32767+12
00046 00015000 DISPLAY "CALLING SUBROUTINE"
00101 00016000 20 CALL SUBROUT(C1,C2,11,12,13)
00111 00017000 DISPLAY "BACK FROM SUBROUTINE"
00143 00018000 STOP
00144 00019000 END
SYMBOL MAP
NAME TYPE STRUCTURE ADDRESS
C CHARACTER SIMPLE VAR Q+ 1, I
C1 CHARACTER SIMPLE VAR Q+ 2, I
C2 CHARACTER ARRAY Q+ 2, I
II INTEGER SIMPLE VAR Q+ 6
I2 INTEGER SIMPLE VAR Q+ 7
I3 INTEGER SIMPLE VAR Q+ 8
I4 INTEGER SIMPLE VAR 0 COMMON
I5 INTEGER SIMPLE VAR 1 COMMON
I6 INTEGER SIMPLE VAR 0+ 3, I
I7 INTEGER SIMPLE VAR Q+ 4, I
I8 INTEGER SIMPLE VAR Q+ 5, I
SUBROUT SUBROUTINE
COMMON BLOCKS
NAME LENGTH
COM' 2
LABEL MAP
STATEMENT CODE STATEMENT CODE STATEMENT CODE
LABEL OFFSET LABEL OFFSET LABEL OFFSET
10 12 20 101
Figure 4-2. Sample FORTRAN Program With Error
Note item 1 in Figure 4-2. This location relative to the start of code
location at 165 gives the PB-relative location 230. The program halted
with the P register at 231 so this is the instruction containing the
error. If you want to continue ignoring this error, enter:
?MR,P
P 2:31 :233
?R
The program continues execution with the statement at location 46 + 165.
Assuming there are no further errors, it will run until normal
termination.
You could also terminate the program by entering:
?E @
The program terminates with the message END OF PROGRAM and returns
control to the operating system.
If you want to display the contents of the statement causing the error,
enter:
?DP-1,3
The three octal words of the instruction will be displayed.
You can also display the contents of the stack at the time of the abort.
The stack analysis showed that S, at this time, was at DB-relative
location 52. Thus, to display the last three words in the stack at that
time, enter:
?DDB+52-3,3
Depending on what you find, you may want to remove the values currently
in the stack. You can do this with the E command as follows:
?E2 Remove 2 words from top of stack and resume,
?R
Since the particular problems causing a program to abort vary widely,
only suggestions can be given here of the particular action to take from
among the many options provided through the DEBUG commands.
USING SETDUMP INTRINSIC INTERACTIVELY
You may include a call to the SETDUMP intrinsic anywhere within your
program. If you want to transfer to DEBUG in case of an abort anywhere
in the program, you should place the call at the beginning. If you only
want DEBUG in case of an abort in a specific section of the program,
place the intrinsic call at the beginning of this section and a call to
RESETDUMP at the end.
Used interactively, no parameters need be included in the intrinsic call
since they will be ignored; control transfers to the DEBUG program
exactly as if the :SETDUMP command had been entered in an interactive
session as described above. If, however, the program may be executed in
batch mode, you should include parameters to specify the portion of the
stack you want dumped in case of an abort in a batch execution. These
parameters are described below under the heading USING SETDUMP INTRINSIC
IN A JOB.
MPE/iX 5.0 Documentation