Halting on a line in C only if a condition is true
Often a particular part of your program works fine for the first
few thousand times, but fails afterward because a specific condition
is present. Setting a simple line breakpoint is an inefficient way
to debug the program because you need to execute the GO
command
a thousand times to reach the specific condition. You can instruct z/OS® Debugger to continue
executing a program until a specific condition is present.
Example: sample C program for debugging
For example, in the
main
procedure of the program
above, you want to stop at T_DIVIDE
only if the divisor
is 0 (before the exception occurs). Set the breakpoint like this:
AT 40 { if(num2 != 0) GO; }
Line 40 is the
statement labeled CALC2 . The command
causes z/OS Debugger to
stop at line 40. If the value of num2
is not 0,
the program continues. You can enter z/OS Debugger commands
to change the value of num2
to a nonzero value.