Restrictions for debugging assembler code that uses instructions as data
z/OS® Debugger cannot debug code that uses instructions as data. If your program references one or more instructions as data, the result can be unpredictable, including an abnormal termination (ABEND) of z/OS Debugger. This is because z/OS Debugger sometimes replaces instructions with SVCs in order to create breakpoints.
For example, z/OS Debugger cannot process the following code correctly:
Entry1 BRAS 15,0
NOPR 0
B Common
Entry2 BRAS 15,0
NOPR 4
Common DS 0H
IC 15,1(15)
In this code, the IC is used to examine the second byte of the NOPR instructions. However, if the NOPR instructions are replaced by an SVC to create a breakpoint, a value that is neither 0 nor 4 might be obtained, which causes unexpected results in the user program.
You can use the following coding techniques can be used to eliminate this problem:
- Method 1: Change the code to reference constants instead of instructions.
- Method 2: Define the referenced instructions by using DC instructions instead of executable instructions.
Using Method 1, you can change the above example to the following code:
Entry1 BAL 15,*+L'*+2
DC H'0'
B Common
Entry2 BAL 15,*+L'*+2
DC H'4'
Common DS 0H
IC 15,1(15)
Using Method 2, you can change the above example to the following code:
Entry1 BRAS 15,0
DC X'0700'
B Common
Entry2 BRAS 15,0
DC X'0704'
Common DS 0H
IC 15,1(15)