Sourceless Debugging with Breakpoint_Assembler user guide
Related topics
Unlike most examples in this guide, this section does not follow a scenario tied to a particular program and is not designed to correct any specific problem. Instead, it demonstrates how you can use sourceless debugging in your environment. With that in mind, you can either use a program of your own, or continue to use the demonstration program CWDEMASM.
In the previous example, Code Debug CICS trapped the program when it encountered an abend, allowing you to fix the problem. This example demonstrates how to set breakpoints to stop the program to gain access to code and data.
With Code Debug CICS, you can set breakpoints at any instruction in any program, regardless of whether you have source code.
- From a cleared screen, type XPED CWDEMASM or XPED followed by your program name. Press Enter.
Since you had previously used the PSEUDOSOURCE command in your debugging session, the Source Listing screen (2.L) ( following figure) is displayed. The program is not running, but you can still set breakpoints.
Setting Breakpoints on the Memory Display Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM CSECT: CWDEMASM COMPILED: 09 JUN 2005 - 11.22
------ ------------------------------------------------- Before CWDEMASM.4 ->
000001 CWDEMASM TITLE 'XPEDITER/CICS PSEUDO ASSEMB
000002 00000000 CWDEMASM CSECT
000003 00000000 MAIN DS 0H
=====> B 00000000 90EC D00C STM 14,12,X'00C'(13)
000005 00000004 183F LR 3,15
000006 00000006 4510 300E BAL 1,X'00E'(0,3)
000007 0000000A 0BA2 BSM 10,2
000008 0000000C 0000 DC XL2'0000'
000009 0000000E 58F0 33E8 L 15,X'3E8'(0,3)
000010 00000012 05EF BALR 14,15
000011 00000014 50D0 1004 ST 13,X'004'(0,1)
000012 00000018 18F1 LR 15,1
000013 0000001A BF1F D018 ICM 1,15,X'018'(13)
000014 0000001E 4780 3028 BZ X'028'(0,3)
000015 00000022 D207 F05C 1000 MVC X'05C'(8,15),X'000'(1)
000016 00000028 18DF LR 13,15
000017 0000002A 58B0 D05C L 11,X'05C'(0,13)
000018 0000002E 4100 D100 LA 0,X'100'(0,13)
000019 00000032 4110 0AA0 LA 1,X'AA0'(0,0)
000020 00000036 41E0 3540 LA 14,X'540'(0,3
2. Position the cursor at the COMMAND field, type BEFORE 0, and press Enter. This sets a breakpoint at the first instruction of the program. You can also set other breakpoints from here, but one will be sufficient.
3. Press Clear to return to CICS.
4. Enter XASM or your own transaction ID to execute the test.
As in the last test, Code Debug CICS displays the following Source Listing Screen (2.L). This time, the program is stopped due to your breakpoint. The first instruction in this program, at offset 000000, is a store multiple (STM). Your program may begin with a different command, but it should still be paused at the beginning.
First Breakpoint on the Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM CSECT: CWDEMASM COMPILED: 09 JUN 2005 - 11.22
------ ------------------------------------------------- Before CWDEMASM.4 ->
000001 CWDEMASM TITLE 'XPEDITER/CICS PSEUDO ASSEMB
000002 00000000 CWDEMASM CSECT
000003 00000000 MAIN DS 0H
=====> B 00000000 90EC D00C STM 14,12,X'00C'(13)
000005 00000004 183F LR 3,15
000006 00000006 4510 300E BAL 1,X'00E'(0,3)
000007 0000000A 0BA2 BSM 10,2
000008 0000000C 0000 DC XL2'0000'
000009 0000000E 58F0 33E8 L 15,X'3E8'(0,3)
000010 00000012 05EF BALR 14,15
000011 00000014 50D0 1004 ST 13,X'004'(0,1)
000012 00000018 18F1 LR 15,1
000013 0000001A BF1F D018 ICM 1,15,X'018'(13)
000014 0000001E 4780 3028 BZ X'028'(0,3)
000015 00000022 D207 F05C 1000 MVC X'05C'(8,15),X'000'(1)
000016 00000028 18DF LR 13,15
000017 0000002A 58B0 D05C L 11,X'05C'(0,13)
000018 0000002E 4100 D100 LA 0,X'100'(0,13)
000019 00000032 4110 0AA0 LA 1,X'AA0'(0,0)
000020 00000036 41E0 3540 LA 14,X'540'(0,3)
While paused, you can set additional breakpoints.
5. If using CWDEMASM, type BEFORE +6A, or check a paper listing to find a valid, executable offset/statement to set a breakpoint in your own application. Press Enter.
6. Once the breakpoint is set, press PF12, or type GO in the COMMAND field and press Enter, to return control to the program. The program will execute until it hits your breakpoint as shown in Source Listing Screen (2.L).
Slow-Motion Execution through Code
While the program is paused at the new breakpoint, you can put the program in slow-motion execution mode to watch as each instruction processes.
- Type GO 10 1 in the COMMAND field and press Enter to execute the next ten instructions. Since you coded a one second delay, each instruction briefly pauses on the screen.
As shown in the following figure, the CWDEMASM program finally comes to a stop at line 43 (offset +98) after executing the ten instructions.
Line 43 (Offset +98) on the Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM ****** ASM-INST AT OFFSET 0092 EXECUTED STEP=00010 *******
------ ------------------------------------------------ Before CWDEMASM.43 ->
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
000033 B 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
000042 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
=====> 00000098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)
000044 0000009E D21C D617 D34A MVC X'617'(29,13),X'34A'(13)
000045 000000A4 D21C D667 D367 MVC X'667'(29,13),X'367'(13)
000046 000000AA D21C D6B7 D384 MVC X'6B7'(29,13),X'384'(13)
000047 000000B0 D21C D707 D3A1 MVC X'707'(29,13),X'3A1'(13)
Viewing Traced Statements
During your test, Code Debug’s trace facility has been active.
- To view what has been traced, press PF17, or enter =2.4 in the COMMAND field and press Enter. If multiple facilities have been traced, the Program Trace Directory screen appears. Select your terminal on that screen.
Since a pseudo-listing appears like a real source listing, the lines executed are displayed on the following Program Trace screen (2.4). With the pseudo-listing lines shown, you can see exactly what was executed. You can scroll through the Program Trace screen (2.4).
Program Trace Screen (2.4)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM CSECT: CWDEMASM COMPILED: 09 JUN 2005 - 11.22
TERM: 1996 ------------------------------------------------ Before CWDEMASM.43
=======> TASK(005411) MODULE:CWDEMASM CSECT:CWDEMASM LANGUAGE:ASSEMBLE
000025 0000004A F820 D25A 3482 ZAP X'25A'(3,13),X'482'(1,3)
000026 00000050 4110 D068 LA 1,X'068'(0,13)
000027 00000054 41E0 3450 LA 14,X'450'(0,3)
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
000033 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
000042 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
******************************** BOTTOM OF DATA *******************************
2. Press PF6, or type =2.L in the COMMAND field and press Enter, to return to the Source Listing screen (2.L).
Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM CSECT: CWDEMASM COMPILED: 09 JUN 2005 - 11.22
------ ------------------------------------------------ Before CWDEMASM.33 ->
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
=====> B 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
000042 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
000043 00000098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)
000044 0000009E D21C D617 D34A MVC X'617'(29,13),X'34A'(13)
000045 000000A4 D21C D667 D367 MVC X'667'(29,13),X'367'(13)
000046 000000AA D21C D6B7 D384 MVC X'6B7'(29,13),X'384'(13)
000047 000000B0 D21C D707 D3A1 MVC X'707'(29,13),X'3A1'(13)
Modifying the Logic Path
You can change a sourceless program’s logic path using the offset option of the GOTO command to branch to another location. This is an excellent method to test code that has not been tested or to which other programs are rarely branched.
- Type GOTO +92, or another offset, in the COMMAND field to change your execution pointer. Press Enter.
As shown in the following figure, the program branched to the new location. If you were to begin single-step execution with the GO command, that instruction would execute.
New Location on the Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM ******************** GOTO OFFSET X'92 ******************
------ ------------------------------------------------ Before CWDEMASM.42
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
000033 B 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
=====> 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
000043 00000098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)
000044 0000009E D21C D617 D34A MVC X'617'(29,13),X'34A'(13)
000045 000000A4 D21C D667 D367 MVC X'667'(29,13),X'367'(13)
000046 000000AA D21C D6B7 D384 MVC X'6B7'(29,13),X'384'(13)
000047 000000B0 D21C D707 D3A1 MVC X'707'(29,13),X'3A1'(13)
Single-Stepping through Code
- Press PF9, or type GO 1 in the COMMAND field and press Enter, to execute the current instruction.
The following figure shows the instruction was executed. The offset was incremented, and a new instruction is shown.
Instruction Executed on the Source Listing Screen (2.L)
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM ****** ASM-INST AT OFFSET 0092 EXECUTED STEP=00001 *******
------ ------------------------------------------------ Before CWDEMASM.43 ->
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
000033 B 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
000042 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
=====> 00000098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)
000044 0000009E D21C D617 D34A MVC X'617'(29,13),X'34A'(13)
000045 000000A4 D21C D667 D367 MVC X'667'(29,13),X'367'(13)
000046 000000AA D21C D6B7 D384 MVC X'6B7'(29,13),X'384'(13)
000047 000000B0 D21C D707 D3A1 MVC X'707'(29,13),X'3A1'(13)
Modifying Registers
Sometimes in testing, you need a different value or address in a register to achieve the desired results. Code Debug CICS gives you this capability.
- Type SET FOOT REGS in the Command Line and press Enter.
This will turn on the Register Footing. The registers you see on your screen are dynamic; as your program manipulates them, you can see them change. You also have the option of changing them yourself.
2. To change the value of register 0, overtype the current value with 001C0000.
3. To change R5 and R14 to high-values and low-values, overtype the contents of the registers with FFFFFFFF and 00000000 respectively. Press Enter.
The following resulting screen shows the changed values in registers R0, R5, and R14.
Remember to end your session as described in Exiting Code Debug CICS and Ending a Debugging Session. Also, if you renamed CWDEMASM at the start of this section, remember to first undo this change on the List of CSECTs screen (2.6.1).
This concludes sourceless debugging using the PSEUDOSOURCE command to create a pseudo-listing. Remember, by using the PSEUDOSOURCE command to create a pseudo-listing, it is the same as any other testing and debugging session in Code Debug CICS.
Modifying Registers on the Source Listing Screen (2.L0 with Foot Regs.
COMMAND ===> SCROLL ===> CSR
MODULE: CWDEMASM CSECT: CWDEMASM COMPILED: 09 JUN 2005 - 11.22
------ ------------------------------------------------ Before CWDEMASM.43 ->
000028 00000058 41F0 33EC LA 15,X'3EC'(0,3)
000029 0000005C 90EF 1000 STM 14,15,X'000'(1)
000030 00000060 9680 1004 OI X'004'(1),X'80'
000031 00000064 58F0 33F0 L 15,X'3F0'(0,3)
000032 00000068 05EF BALR 14,15
000033 B 0000006A D501 B018 3466 CLC X'018'(2,11),X'466'(3)
000034 00000070 4720 30F8 BH X'0F8'(0,3)
000035 00000074 4100 D477 LA 0,X'477'(0,13)
000036 00000078 4810 D260 LH 1,X'260'(0,13)
000037 0000007C 41E0 D476 LA 14,X'476'(0,13)
000038 00000080 58F0 33F4 L 15,X'3F4'(0,3)
000039 00000084 0E0E MVCL 0,14
000040 00000086 D20E D477 D2FC MVC X'477'(15,13),X'2FC'(13)
000041 0000008C D204 D48B D30B MVC X'48B'(5,13),X'30B'(13)
000042 00000092 D21C D527 D310 MVC X'527'(29,13),X'310'(13)
=====> 00000098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)
--------------------- C U R R E N T R E G I S T E R S ---------------------
R0-R7 001C0000 00000000 380A5828 396F2328 380A4F60 FFFFFFFF 3784CD0E 3784DD0D
R8-R15 3784ED0C 3784FD0B 37850D0A 002400D0 008A8000 0024B608 00000000 40000000
INSTRUCTION: B96F23C0 00098 D21C D577 D32D MVC X'577'(29,13),X'32D'(13)