Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging a Program … Using the PC/370 Emulator Interactively !

Similar presentations


Presentation on theme: "Debugging a Program … Using the PC/370 Emulator Interactively !"— Presentation transcript:

1 Debugging a Program … Using the PC/370 Emulator Interactively !

2 Debug features available? Program Flow Trace with Breakpoints Display register contents Display memory contents Data and/or address stop, if needed

3 Interactive Debug Options: There are more options, but these are the ones you will most likely use. PSW automatically displays each time. Debug OptionExplanation DDump (display) a memory location MModify a memory location RDisplay general purpose registers

4 Enter option- D,M,R (‘H’ lists all options) EP = Entry Point A=Address Following 370 A = Failing Address in PSW OP = instruction at the failing PSW address Remember that most times, the failing address (0002B6 in this example) points to the next instruction to be executed. The failing instruction has already had its PSW address updated to point to the next instruction, but this instruction failed in execution. In PC/370, programs are loaded into memory at 000200, so relating the failing instruction address to your program, this would be the instruction (in your PRN listing) at offset 0000B6, actually the instruction before this one, that failed. You most likely would wish to see the registers first, so enter option ‘R’

5 Other Debug Aids Assembler Output Listing Fragment (.PRN file) Location Counter (Displacement from location zero) Object Code Addr1Addr2 (Displacements of operands from zero) Assembler Statement Number

6 Other Debug Aids A Test Plan –Unit Testing: each module functions properly –System Testing: all modules function together –Acceptance Testing: User sign-off Before testing, develop & document a plan –Test all possible conditions – major ones 1 st –Develop test data –Test: comparing & documenting results against expected results From Experience –Don’t try to test too much of a program at one time. Create little chunks. –If you make a change to your code, save the old code before changing it

7 So – your program ends abnormally ?? 1.Find the instruction that led to the problem Location immediately following the failing instruction Instruction following the failing instruction

8 2.Find the cause of the error 3.Fix it So – your program ends abnormally ?? PSW Address when program failed and the instruction at that location. We know that it was the instruction prior to the instruction that failed (SVC 2 @ 0000B4). This is instruction is part of the CLOSE that has the +++++ to the left. We probably have something wrong with either our DCB or the data file that is being closed.

9 You may also get yourself an abnormal completion code … CodeTypeMeaning 0C1OperationInvalid operation code 0C4SecurityProtection Exception 0C5AddressingAddress is out of range 0C7DataInvalid Data for Instruct. 0CADecimalDecimal Overflow If so, examine the completion code meaning:

10 When the program abnormally terminates you can enter most any of the debugging codes (‘R’ was used in this case) to display the current registers. The PSW also is displayed and the ABEND code appears as well.

11 Finding the Failing Instruction Subtract START address from the Interrupt address. Use.PRN listing to locate failing instruction using the Location Counter Failing instruction is the one before the difference calculated in number 1 above

12 Failing Address Fail Addr 02B4 Load Addr- 0200 00B4 PSW Memory @ PSW 02B4 Enter ‘R’ for Register display, PSW, and memory fragment

13 Program failed in GET …

14 Back to the source code

15 REALTORS file is not located on H: drive. It’s on the same drive as the program (f:) – note the DDNAME parameter …

16 Another Example 49C -200 29C Data at loc. ’49C’ looks like EBCDIC data. You can’t execute data …

17

18 So What Happened? Program is trying to execute instructions at location X’29C’ which is the beginning of the output DCB Instruction is the op.code ‘C1’ What is op.code ‘C1’ ? There is no valid op.code ‘C1’ So how did the location counter get to be ’29C’?

19 Harmlessly and minding its own business, program is executing along to a BAL @ F4, jump to 10C and execute along some more to a B OUTPUT… Where is OUTPUT defined?

20 OUTPUT is the DCB the program was trying to execute. That makes for an invalid Branch instruction

21 Invalid Branch probably should have been a BR 5 – since we were in a subroutine that program did a BAL to

22 Register 5 BAL instruction B OUTPUT BAL executed correctly – note contents of Reg 5 But addess in B OUTPUT probably should be the address in Reg 5, but it’s not

23 A Real Example 336 -200 136

24 When you get into trouble, the first thing you should ask for is to see the registers at the time of the failure. This also provides the PSW at the time of the failure and 16 bytes of memory at the location of the failure. This also includes the ABEND code, if present. In this case, the ABEND code is 0C7, which is a data exception

25 Here is the failing instruction – actually the failing instruction is the instruction above the one that the PSW highlights – the first CVB instruction.

26 For both CVB instructions, the data locations are defined as shown. Do you see something wrong?

27 CURRPRC(7) 0000003652987F 53B CURRENTP(7) F3F6F5F2F9F8F7 CALCPACKCURRPRC(7),CURRENTP(7) APCURRTOTL(7),CURRPRC(7) CVB4,CURRPRC CURRTOTL(7) 0000003652987C R4

28 So what is the error ? Memory Location for CVB and CVD must be an eight- byte field. In this case, it is defined as 7-bytes

29 Not Always That Easy … Develop a foolproof approach –Find Completion Code, if one exists –Obtain Location counter value by subtracting START from failing address –Find the instruction in assembly listing –Now you may need register contents, memory locations, and more –Insert WTOs into your code at key points –Rerun, retest, etc.

30 Consider Printing the Debug Guide \FULL \DOC \USER.DOC


Download ppt "Debugging a Program … Using the PC/370 Emulator Interactively !"

Similar presentations


Ads by Google