Debugging a sourceless program for C
Code Debug TSO allows you to interactively debug programs that do not have the source available (no source listing in the DDIO). You can choose either of two available methods.
If requested, Code Debug TSO can create a “pseudo-assembler” view of the object code. With this method, a temporary source member will be created. This allows you to debug main programs and subprograms while employing the same strategy you would use if a DDIO source listing had been created during assembly. See Creating Pseudo-Assembler Source for more information.
You can also choose to use Code Debug’s traditional support for programs without source. With this support, you can debug “sourceless” main programs, subprograms, or GETMAINed areas in the same manner as interactive source level debugging, with a few differences. Test session setup and startup is the same as setting up a session to interactively debug at the source level. The differences occur during the debugging session:
- Code Debug TSO debugging commands such as AFTER, BEFORE, COUNT, ONETIME, SKIP, TRACE, WHEN, PEEK, KEEP, GOTO, and DELETE cannot be used.
- To set a breakpoint, you must use the AT command, which sets a before breakpoint.
When the AT breakpoint is reached, the AT Display screen shows your sourceless program in dump format. You can enter Code Debug TSO debugging commands such as GPREGS, MEMORY, SHOW, and so on.
Accessing a sourceless main program
When program execution begins and the main program does not have source, the session log is automatically displayed with the message,
NO SOURCE LISTING DATA SET MEMBER FOR program-name.
See the following figure.
Showing No Source Message for a Main Procedure
COMMAND ===> SCROLL ===> CSR
NO SOURCE LISTING DATA SET MEMBER FOR TRIMAINC
----------------------------------------------------------- Before TRIMAINC ->
********************************* TOP OF DATA **********************************
+-----------------------------------------------------------------------------+
: JOB: FLGDAA1 :
: CODE DEBUG TSO REL 17.02.00 CUSTOMER # 010000 STEP: ATSOPROC :
: DATE: 04/01/2023 :
: BMC ONLINE LICENSING TIME: 08.17.37 :
: SYSTEM: SYS1 :
+-----------------------------------------------------------------------------+
XPED TSO SPF
TEST TRIMAINC
*** TRIMAINC FROM USERID0.C.LOADLIB LINK 08/14/2000
NO SOURCE LISTING INFORMATION FOUND FOR MODULE
******************************** BOTTOM OF DATA ********************************
You can use the AT command on the Log screen to set a breakpoint in the specified program if you are familiar with the program. However, if you are not familiar with the program, you can use the MEMORY command to display the program in dump format. For example:
displays the Memory screen showing a dump of TRIMAINC.
The AT command can then be entered to set breakpoints in the program. Issuing the AT command will also load the module into memory if it is not loaded. The full syntax of the AT command is provided in the Command-and-syntax-reference space.
For example, entering the following on the Memory screen displays the AT Display screen shown in the following figure.
AT Display Screen
COMMAND ===> SCROLL ===> CSR
AT ADDRESS 107D9A56 : 90E8D00C : STM 14,8,12(13)
-------------------------------------------------------- Before TRIMAINC+26 --
BASE = 107D9A30 0 - 2 - 4 - 6 - 8 - A - C - E - = 0-2-4-6-8-A-C-E-
000026 ===> 00E8D00C 58E0D04C 4100E090 5500C314 = .Y}..\}<..\...C.
000036 ===> 4720F014 58F0C280 90F0E048 9210E000 = ..0..0B..0\.k.\.
000046 ===> 50D0E004 18DE0530 5010D080 58503136 = &}\.....&.}..&..
000056 ===> 5860D080 D203D084 60005050 D0884110 = .-}.K.}d-.&&}h..
000066 ===> D08458F0 313A05EF 5860D080 58606000 = }d.0.....-}..--.
000076 ===> D7036018 60185880 D0805880 80005870 = P.-.-...}.......
000086 ===> D0804160 801C5060 70005860 D080D203 = }..-..&-...-}.K.
000096 ===> D0846000 41605018 5060D088 4110D084 = }d-..-&.&-}h..}d
0000A6 ===> 58F0313A 05EF5860 D0805860 6000D703 = .0.....-}..--.P.
0000B6 ===> 60186018 5880D080 58808000 5870D080 = -.-...}.......}.
0000C6 ===> 4160801C 50607000 5860D080 D203D084 = .-..&-...-}.K.}d
0000D6 ===> 60004160 502C5060 D0884110 D08458F0 = -..-&.&-}h..}d.0
0000E6 ===> 313A05EF 5860D080 58606000 D7036018 = .....-}..--.P.-.
0000F6 ===> 60185880 D0805880 80005870 D0804160 = -...}.......}..-
000106 ===> 801C5060 70005860 D080D203 D0846000 = ..&-...-}.K.}d-.
000116 ===> 4160503E 5060D088 4110D084 58F0313A = .-&.&-}h..}d.0..
000126 ===> 05EF5860 D0805860 6000D703 60186018 = ...-}..--.P.-.-.
000136 ===> 41605050 5060D084 4160505A 5060D088 = .-&&&-}d.-&!&-}h
000146 ===> 4110D084 58F03142 05EF5860 313E50F0 = ..}d.0.....-..&0
If the address specified with the AT command is not a valid instruction (data or privileged), a message is returned. Also, if the specified program has source, no breakpoint is set and the message MODULE HAS SOURCE; USE Xpediter BREAKPOINT COMMANDS is displayed.
On the AT Display screen, the offset and the instruction pointer are highlighted, indicating where the breakpoint is set. The message area contains the breakpoint address and the instruction in hexadecimal and mnemonic form. If the AT command is used on an address and not in a module loaded by Code Debug TSO, the compile date and time displayed on the third line will be blank.
Accessing a Sourceless Subprogram
When your debugging session begins and your main program has source, the Source display screen is displayed. You can set breakpoints in the regular manner on this screen.
Normally, breakpoints can be set in a subprogram by entering a fully qualified breakpoint command or using the SOURCE or INTERCEPT commands to access the subprogram from this screen. However, if the subprogram does not have source, the message NO SOURCE LISTING INFORMATION FOUND FOR MODULE is displayed at the top of the source display.
If you are not familiar with the program, you can use the MEMORY command to access main storage and display the module in dump format on the Memory screen. For example:
With the program displayed on the Memory screen, you can decide exactly where you want to set breakpoints using the AT command.
If you are familiar with the application you are debugging, you can use the AT command with the module/external function. For example, to set a breakpoint at displacement 0 into an external function, enter:
Using Code Debug TSO Commands for Sourceless Debugging
The rules for using Code Debug TSO commands for sourceless debugging are as follows:
Primary Commands
None of the debugging commands, such as AFTER, BEFORE, COUNT, ONETIME, SKIP, TRACE, WHEN, PEEK, KEEP, GOTO, GO n, and DELETE are valid. The GO command is valid. All other commands can be used.
Line Commands
The only valid line commands are X (eXclude) and T (Template). To insure proper results, the rest of the line command area should be blanked out after entering the line command.
The following are examples of using some Code Debug TSO commands to debug a sourceless program.
Using the UP command on the AT Display screen scrolls the screen toward the beginning of the module/procedure. Scrolling beyond the beginning of the module/procedure displays negative offsets. Using the LOCATE * command scrolls to the current execution point.
The GPREGS command can be used to open a modifiable window at the bottom of your screen. The register values displayed can be changed by typing over the values. An example of the GPREGS window is shown in the following figure.
GPREGS Window on the AT Display Screen
COMMAND ===> SCROLL ===> CSR
PROGRAM: TRIMAINC MODULE: TRIMAINC COMP DATE: 08/15/2000 COMP TIME:08:44:38
-------------------------------------------------------- Before TRIMAINC+26 --
BASE = 107D9A30 0 - 2 - 4 - 6 - 8 - A - C - E - = 0-2-4-6-8-A-C-E-
******************************** TOP OF DATA **********************************
000000 ===> 47F0F026 01C3C5C5 00000090 000001BC = .00..CEE........
000010 ===> 47F0F001 183F58F0 C31C184E 05EF0000 = .00....0C..+....
000020 ===> 000047F0 303A00E8 D00C58E0 D04C4100 = ...0...Y}..\}<..
000030 ===> E0905500 C3144720 F01458F0 C28090F0 = \...C...0..0B..0
000040 ===> E0489210 E00050D0 E00418DE 05305010 = \.k.\.&}\.....&.
000050 ===> D0805850 31365860 D080D203 D0846000 = }..&...-}.K.}d-.
000060 ===> 5050D088 4110D084 58F0313A 05EF5860 = &&}h..}d.0.....-
000070 ===> D0805860 6000D703 60186018 5880D080 = }..--.P.-.-...}.
000080 ===> 58808000 5870D080 4160801C 50607000 = ......}..-..&-..
000090 ===> 5860D080 D203D084 60004160 50185060 = .-}.K.}d-..-&.&-
0000A0 ===> D0884110 D08458F0 313A05EF 5860D080 = }h..}d.0.....-}.
0000B0 ===> 58606000 D7036018 60185880 D0805880 = .--.P.-.-...}...
0000C0 ===> 80005870 D0804160 801C5060 70005860 = ....}..-..&-...-
0000D0 ===> D080D203 D0846000 4160502C 5060D088 = }.K.}d-..-&.&-}h
GPREGS R0 ==> 001552E0 R1 ==> 001552D8 R2 ==> 90991E7A R3 ==> 907D9C76
R4 ==> 8011AB84 R5 ==> 107D9F20 R6 ==> 00155268 R7 ==> 107D9FBC
R8 ==> 00000001 R9 ==> 80000000 R10 ==> 90991DBA R11 ==> 8011AAA0
R12 ==> 001487B8 R13 ==> 001551E0 R14 ==> 907D9C96 R15 ==> 107D9A30
Data and instruction areas can be typed over, as long as a breakpoint is not set on the instruction being typed over.
The SHOW ACTIVE command can be entered to display a summary of general-purpose register contents, PSW, and some control block information. The result of the SHOW ACTIVE command is shown in the following figure.
SHOW ACTIVE Display Screen
GPREGS R0 ==> 001552E0 R1 ==> 001552D8 R2 ==> 90991E7A R3 ==> 907D9C76
R4 ==> 8011AB84 R5 ==> 107D9F20 R6 ==> 00155268 R7 ==> 107D9FBC
R8 ==> 00000001 R9 ==> 80000000 R10 ==> 90991DBA R11 ==> 8011AAA0
R12 ==> 001487B8 R13 ==> 001551E0 R14 ==> 907D9C96 R15 ==> 107D9A30
FP REGS 0 4D00000002BD4D40 1 0000000000000000
2 0000000000000000 3 0000000000000000
4 0000000000000000 5 0000000000000000
6 0000000000000000 7 0000000000000000
8 0000000000000000 9 0000000000000000
10 0000000000000000 11 0000000000000000
12 0000000000000000 13 0000000000000000
14 0000000000000000 15 0000000000000000
ARREGS R0 ==> 00000000 R1 ==> 00000000 R2 ==> 00000000 R3 ==> 00000000
R4 ==> 00000000 R5 ==> 00000000 R6 ==> 00000000 R7 ==> 00000000
R8 ==> 00000000 R9 ==> 00000000 R10 ==> 00000000 R11 ==> 00000000
R12 ==> 00000000 R13 ==> 00000000 R14 ==> 00000000 R15 ==> 00000000
PSW XRXXXTIE KEY CMWP SH CC PROGMASK AMODE INSTR ADDR
00000111 8 1101 00 01 0100 0 107D9A56
INSTR
ADDRESS 107D9A56 : 90E8D00C
OPCODE STM
OP1 R14 : 907D9C96
OP3 R8 : 00000001
OP2 001551EC : 40404040
TCB 00873298
ASID 0217
CVT 00FCFD28
JSCB 008FD0CC
TIOT 008C8000
******************************** BOTTOM OF DATA ********************************
The END command returns you to the previously displayed GPREGS Window on the AT Display screen as shown in the figure above.
The SHOW AT command can also be entered to display all the outstanding breakpoints set by the AT command.
Use the DELETE AT command to remove all outstanding AT breakpoints.