DEBUGGING PROGRAM OBJECT: DBUG This program is used as an aid to debugging programs, it will mormally be 'linked' to a running program on the system using the command 'T' (for details see later), all accesses to locations will then be made in that programs virtual memory. It may be used to:- 1) SET and CLEAR breakpoints 2) Dump out the PSECT, REGISTERS and/or the IMP STACK. 3) EXAMINE and CHANGE locations in core. 4) DUMP general areas of core. DEBUG indicates its readiness to accept commands by typing 'DEBUG:'. The following commands may be used. T - Set Task number of program to be debugged. B - Set breakpoint. C - Clear breakpoint. N - Set a new program code base. R - Dump the REGISTERS. P - Dump the PSECT. I - Dump the IMP stack. A - Do 'P', 'R', and 'I'. D - Dump an area of core. O - Change the output device. W - WAIT DEBUG. S - Stop DEBUG. ? - Print options. In addition to these commands, there is an implied command, activated by typing an octal digit, that enters the location examination/change part of DEBUG. A detailed description of each command follows. T - SET TASK NUMBER The prompt 'TASK ID:' is output and the (octal) ID of the program to be debugged should be entered. The TASK ID of a running program may be obtained by typing the command 'TASKS' to the command language interpreter. NOTE: Only the commands 'T', 'N', 'O', 'S' and 'W' may be used before 'T' is used for the first time. B - SET BREAKPOINT The prompt 'ADDR:' is output, the reply is the RELATIVE address (wrt the start of the program) of the desired breakpoint. Debug will remember the contents and place a 'BR ' in the location. This will cause the program to loop when it executes that instruction. Debug replies: BP: n ADDR: n2 CONT= n3 - where 'n' is the breakpoint number (between 0 and 20), 'n2' is the virtual address, and 'n3' the original contents. The message 'BP TABLE FULL' is output if more than 21 breakpoints are used. See the command 'N' for setting breakpoints in external routines. C - CLEAR BREAKPOINTS Prompts 'NO?'. The breakpoint number should be typed. 'A' or '-1' is typed if ALL the breakpoints are to be cleared. If the specific breakpoint has not been set, the message '?' is output. The original contents are replaced. N - SET A NEW PROGRAM CODE BASE Prompts 'NEW PROGRAM CODE:'. Reply giving the new address. This command is useful for programs using external routines. To set a breakpoint in an external routine, the code base is set to that of the external routine, as printed out by the LINKER, and the relative address specified. This does not effect any previously set breakpoints. R - PRINT REGISTERS. This command prints the registers of the nominated task. The LOCAL NAME BASE (LNB) for the outer level is also printed. P - PRINT THE PSECT The PSECT (own system variables) of the nominated task is printed. The command :- 1) Prints the name of the task 2) Prints the state of the task. 3) Indicates whether there are messages queued. 4) Calls 'REGISTERS' to dump the registers out. 5) Prints the contents of the segmentation registers in the form:- REGISTER number ADDRESS LENGTH. I - PRINT THE IMP STACK The entire IMP STACK is printed on the output device. NOTE: The GLA of the program is held at the low address end of the stack, the IMP stack (ie the SP stack) starts at the high address end and works towards the low address end. is not the same as the start of the stack. A - PRINT ALL The command executes a print psect (P), print registers (R) and the IMP stack (I). This command is useful for dumping all the relevant information about a program onto the line printer (see command 'O'). D - DUMP AN AREA OF CORE Prompts 'FROM:' and 'LENGTH:'. Both numbers should be typed in octal and the area of core from 'FROM' to 'FROM+LENGTH' is output. NOTE: 1) On all the dumps 'ZEROES' is ouput if one or more entire line contains zero. 2) An ISO equivalent is printed on the RHS of the dump. O - CHANGE THE OUTPUT DEVICE Prompts 'STREAM:'. The reply is used in the form 'SELECT OUTPUT(N)' for the output of commands R,P,I,A and D. By calling 'DBUG' in the form:- DBUG /L or DBUG /.LP etc the output may be directed to the file 'L' or to the line printer. W - WAIT DEBUG This command is used to suspend DEBUG if it is necessary to input to a program on the same teletype. It is restarted by (ESCAPE) FREE DBUG S - STOP DEBUG Debug halts. Note: all breakpoints are cleared. IMPLIED COMMAND TO EXAMINE/CHANGE CORE ADDRESSES This command accepts the following instructions:- Note 'N' and 'M' represent numbers input in octal. N : prints contents of N. N+C : prints contents of (N+ program base). N+I : prints contents of (N+ IMP STK base). N+RM : prints contents of (N+REGISTER M) N(+ options)=m : puts M into N eg: DEBUG:100 (cr) - will print contents of locn 100. DEBUG:100+R5 (cr) - will print contents of 100 on from reg. 5. DEBUG:100+R5=200 (cr) - ditto, except plants 200. NOTES An '*N' at the end of the command will cause the following 'N' locations to be dumped out ('N' may be negative). '+' or '+=M' may be entered as a new command, this takes the last location used and steps it up by 2 (-2 if '-' is used).