pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-12
Overflow Traps Considerations
The following notes apply to Table 20-2 on page 20-11:
Column S is a line number.
Column P shows the sequence of statements executed in the sample code.
The three right-hand columns show the trapping state of the program, which starts
in either procedure m1 or m2.
Columns TNS(m1) and TNS(m2) illustrate program behavior as a TNS process.
Procedure m2 includes a block overflow trapping attribute.
At lines 2, 7, and 19, the overflow traps procedure attribute has no effect on
overflow trapping for a TNS process, but does change overflow trapping for a
native process.
The trapping state of the code at lines 25 through 27 differs for TNS and native
processes depending on the state of overflow traps upon entering q. For a native
process, overflow traps are guaranteed to be enabled because of the
OVERFLOW_TRAPS procedure attribute. For a TNS process, the trapping state
upon entering Q depends on the trapping state in the procedure that calls q,
namely, m1 or m2.
Overflow Traps Considerations
This topic covers considerations for using overflow traps.
For a TNS process, if traps are enabled and an overflow occurs, your program
traps to the operating system’s trap handler. Your program cannot recover from this
state. You can, however, call ARMTRAP or, if your program is a privileged
program, SETTRAP, to disable traps. If a trap occurs, your program calls Debug or
Inspect, according to how you have set up your environment.
34 1 PROC m1 MAIN; Enabled Enabled
35 2 BEGIN Enabled Enabled
36 3 CALL q; Enabled Enabled
37 30 END; ! PROC m1 Enabled Enabled
38
39 1 PROC m2 MAIN; Enabled Enabled
40 2 BEGIN:DISABLE_OVERFLOW_TRAPS Disabled Disabled
41 3 CALL q; Disabled Disabled
42 30 END; ! PROC m2 Enabled Enabled
Table 20-2. TNS Versus Native Overflow Trapping Behavior (page 2 of 2)
S P Statements TNS(m1) TNS(m2) Native