Sometimes this is enough information for you to correct the error in
your source program, recompile it and attempt to execute it again. When this information does not immediately identify the problem in
your program, you can begin debugging procedures using V5/370. To
access your program's storage areas and registers you can enter the command: debug
immediately after receiving the abend message. This command places your
virtual machine in the debug environment.
To check the contents of general registers 0 through 15, issue the DEBUG subcommand:
gpr 0 15
If you want to look at only one register, enter:
gpr 3 You might also wish to check the program status word (PSi). Use the PSi subcommand: psw You can examine storage areas in your program using the X subcommand: X 201AC 20 In this example, the subcommand requests a display of 20 bytes,
beginning at location 201AC in your program. User programs executed in CMS are always loaded beginning at location X'20000' unless you specify
a different address on the LOAD or FETCH command. To identify the
virtual address of any instruction in a program, you only need to add 20000 to the hexadecimal instruction address. RESUMING EXECUTION AFTER A PROGRAM CHECK On occasion, you will be able to determine the cause of a program check
and continue the execution of your program. There are DEBUG subcommands you can use to alter your program while it is in storage and resuae
execution.
If, for example, the error occurred because you had forgotten to
initialize a register to contain a zero, you could use the DEBUG subcommand SET to place a zero in the register, and then resuae
execution with the GO subcommand. You can use the GO subcommand to
specify the instruction address at which you want execution to begin:
set gpr 11 0000 go 200BO An alternate method of specifying a starting address at which execution
is to resume is by using the SET subcommand to change the last word of
the PSi: set psw 0 000200BO go
212 IBM VM/370 CMS User's Guide
If your program executes successfully, you can then make the
necessary changes to your source file, recompile, and continue testing.
Using DEBUG Subcommands to Monitor Program
Execution
The preceding examples did not represent a wide range of the
possibilities for DEBUG subcommands. Nor do they represent the only way
to approach program debugging. Some additional DEBUG subcommands are
illustrated below. For complete details in using these subcommands,
refer to the gyg When you prepare to debug a program with known problems, or when you
are beginning to debug a program for the first time, you might want to
stop program execution at various instructions and examine the
registers, constants, buffers, and so on. To temporarily stop program
execution, use the BREAK subcommand to set breakpoints. You should set
breakpoints after you load the program into storage, but before you
begin executing it. You can set up to 16 breakpoints at one time. For
each breakpoint, you assign a value Cid), and an instruction address:
load myprog
debug break 0 20BCO break 1 20C10 break 2 20DOO Then, you can return to CMS and begin execution:
return
start When the first breakpoint in this example is encountered, you receive
the messages: DEBUG ENTERED.
BREAKPOINT 0 AT 20BCO Then, in the debug environment, use the subcommands GPR, CSW, CAW, PSi, and X to display registers, control words, or storage locations. You can resume program execution with the GO subcommand:
go
If, at any time, you decide that you do not want to finish executing
your program, but want to return to the eMS environment immediately, you
must use the HX subcommand:
hx
There are three subcommands you can use to exit from the debug
environment:
1. RETURN, to return to the CMS environment when DEBUG is entered with
the DEBUG command
2. GO, to resume program execution when it has been interrupted by a
breakpoint
3. HX, to halt program execution entirely and return to the CMS environment Section 11. How VM/370 Can Help You Debug Your programs 213
Previous Page Next Page