RUNNING WITH THE DEBUG INTRINSIC [ MPE Debug/Stack Dump Reference Manual ] MPE/iX 5.0 Documentation
MPE Debug/Stack Dump Reference Manual
RUNNING WITH THE DEBUG INTRINSIC
When the call to DEBUG is executed, the program pauses at the next
location. This break is equivalent to the break at the location of the
call to DEBUG. DEBUG displays the message:
*DEBUG* s.nnn (where s is the segment number; nnn the breakpoint)
The DEBUG prompt, a question mark, is then issued and you can respond
with any of the DEBUG commands exactly as if you had run the program with
the DEBUG parameter, as described earlier in this section.
:FORTRAN DBTEST
PAGE 0001 HP32102B.00.0
00001000 $CONTROL MAP,LABEL,LOCATION,USLINIT
00012 00002000 PROGRAM MAIN
00012 00002100 SYSTEM INTRINSIC DEBUG --- 1
00012 00003000 CHARACTER*8 C,C1,C2(3)
00012 00004000 COMMON I4, I5
00012 00006000 DATA C/"DBTEST1"/
00012 00007000 DATA Cl/"MAINPROG"/,C2/"MONE","MTWO","MTHREE"/
00012 00008000 DATA I6/10000/,I7/700/,I8/800/
00012 00008100 CALL DEBUG --- 2
00013- 3 00009000 10 DISPLAY C1,C2
00032 00010000 I1 = -1
00034 00011000 I2 = 1
00036 00012000 13 = 10
00040 00013000 I4 = 100
00042 00014000 I5 = 1000
00044 00015000 DISPLAY "CALLING SUBROUTINE"
00076- 4 00016000 20 CALL SUBROUT (C1,C2,I1,I2,I3)
00106 00017000 DISPLAY "BACK FROM SUBROUTINE"
00140 00018000 STOP
00141 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
DEBUG SUBROUTINE
I1 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 Q+ 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 13 20 76
Figure 3-6. Sample FORTRAN Program With Call to DEBUG
00005 00020000 SUBROUTINE SUBROUT(D1, D2,J1,J2,J3)
00005 00021000 CHARACTER*8 D1,D2(3)
00005 00021100 COMMON J4,J5
00005 00022000 D1 = "SUBROUT"
00021 00023000 D2(1) = "SBONE"
00037 00024000 D2(2) = "SBTWO"
00055 00025000 D2(3) = "SBTHREE"
00074- 5 00026000 30 DISPLAY D1,D2
00113 00027000 J1 = -9
00115 00028000 J2 = 9
00117 00029000 J3 = 90
00121 00030000 J4 = 900
00123 00031000 J5 = 9000
00125- 6 00032000 40 DISPLAY "RETURNING TO MAIN PROGRAM"
00164 00033000 RETURN
00165 00034000 END
SYMBOL MAP
NAME TYPE STRUCTURE ADDRESS
D1 CHARACTER SIMPLE VAR Q- 8,I
D2 CHARACTER ARRAY Q- 7,I
J1 INTEGER SIMPLE VAR Q- 6,I
J2 INTEGER SIMPLE VAR Q- 5,I
J3 INTEGER SIMPLE VAR Q- 4,I
J4 INTEGER SIMPLE VAR 0 COMMON
J5 INTEGER SIMPLE VAR 1 COMMON
SUBROUT SUBROUTINE
COMMON BLOCKS
NAME LENGTH
COM' 2
LABEL MAP
STATEMENT CODE STATEMENT CODE STATEMENT CODE
LABEL OFFSET LABEL OFFSET LABEL OFFSET
30 74 40 125
**** GLOBAL STATISTICS ****
**** NO ERRORS, NO WARNINGS ****
TOTAL COMPILATION TIME 0:00:04
TOTAL ELAPSED TIME 0:06:22
END OF COMPILE
Figure 3-6. Sample FORTRAN Program With Call to DEBUG (Continued)
:PREP $OLDPASS,DBPROG;PMAP
PROGRAM FILE DBPROG.PUB.TECHPUBS
COMMON ARRAY ALLOCATION
NAME ADR LEN
COM' 31 2
SEG' 0
NAME STT CODE ENTRY SEG
SUBROUT 1 0 0
TFORM' 3 | ?
FMTINIT' 4 | ?
BLANKFILL' 5 1 ?
SIO' 6 | ?
ASIO' 7 | ?
MAIN 2 165 172
DEBUG 2 -- 10 ?
TERMINATE' 11 ?
SEGMENT LENGTH 340
PRIMARY DB 2 INITIAL STACK 1440 CAPABILITY 600
SECONDARY DB 33 INITIAL DL 0 TOTAL CODE 340
TOTAL DB 35 MAXIMUM DATA ? TOTAL RECORDS 6
ELAPSED TIME 00:01:02.274 PROCESSOR TIME 00:00.417
END OF PREPARE
Figure 3-7. PMAP Listing For FORTRAN Program with DEBUG Intrinsic
You can determine where the first break occurs in your program by adding
the location of the first instruction after the DEBUG Call (item 3,
Figure 3-6) to the start of code for the main Program (item 1, Figure
3-7. In the sample program, the first break will occur at a location
determined as follows:
13 (octal) + 165 (octal) = 200 (octal)
(Refer to Figure 3-8 for an illustration of running a program containing
a call to DEBUG.) In this example, all subsequent breakpoints are set
when the program pauses for the first time because of the call to DEBUG.
Since this break is equivalent to a break at label 10, only the
breakpoints at labels 20, 30, and 40 are set at this time. Otherwise,
the breakpoints are the same as those set in Figure 3-3, either initially
or with the R command. Figure 3-8 simply uses the D command to display
items at each of the four breakpoints. Since there is no difference in
the use of DEBUG commands when a program is run with the DEBUG parameter
or contains a call to DEBUG internally, no attempt is made to illustrate
DEBUG commands in this example. Rather it illustrates the program flow
at each of the breakpoints as indicated in the following key to the
numbered items.
Key to items in Figure 3-8 are:
1 Location of first breakpoint at label 10 (165+ 13)
2 Set three more breakpoints at labels 20, 30, and 40
3 Display I6, I7, and I8 set by DATA statement
4 Display 8-character item C set by DATA statement
5 Display 8-character item C1 set by DATA statement
6 Display 3 elements of array C2 set by DATA statement
7 Location of second breakpoint at label 20 (165+76)
8 Display items I1, I2, I3 set between labels 10 and 20
9 Display items I4, and I5 set between labels 10 and 20
10 Location of third breakpoint at label 30 in SUBROUT
11 Display 8-character item D1 set prior to label 30 in
SUBROUT
12 Display 3 elements of array D2 set prior to label 30
13 Display items J1, J2, and J3 passed from program MAIN
14 Display items J4 and J5, items common to I4 and I5 set
in MAIN
15 Location of last breakpoint at label 40 in SUBROUT
16 Display items J1, J2, and J3 set between labels 30 and
40
17 Display items J4 and J5 set between labels 30 and 40
:RUN DBPR
*DEBUG* 0.200 -- 1
?B 165+76,74,125 -- 2
?D Q+3:,3,I
DB+26 +10000 +00700 +00800 -- 3
?D Q+1
Q+1 000004
?D 4/2,4,A
DB+2 DBTEST1 -- 4
?D Q+2
Q+2 000014
?D 14/2,4,A
DB+6 MAINPROG -- 5
?D 14/2+4,4,A
DB+12 MONE
?D 14/2+4,#12,A
DB+12 MONE MTWO \ 6
DB+ 22 MTHREE /
?R
MAINPROG MONE MTWO MTHREE
CALLING SUBROUTINE
*BREAK* 0.263 -- 7
?D Q+6,3,I
Q+ 6 -00001 +00001 +00010 -- 8
?D 31,2,I
DB+31 +00100 +01000 -- 9
?R
*BREAK* 0.74 -- 10
?DQ-7
Q-7 000014
?D 14/2,4,A
DB+6 SUBROUT -- 11
?D Q-#8
Q-10 000014
?D 14/2+4,#12,A
DB+12 SBONE SBTWO \ 12
DB+22 SBTHREE /
?D Q-6:,3,I
DB+47 -00001 +00001 +00010 -- 13
?D 31,2,I
DB+31 +00100 +01000 -- 14
?R
SUBROUT SBONE SBTWO SBTHREE
*BREAK* 0.125 -- 15
?D Q-6:,3,I
DB+47 -00009 +00009 +00090 -- 16
?D 31,2,I
DB+31 +00900 +09000 -- 17
?R
RETURNING TO MAIN PROGRAM
BACK FROM SUBROUTINE
END OF PROGRAM
Figure 3-8. DEBUG Example From Program With DEBUG Intrinsic
MPE/iX 5.0 Documentation