Previous | Contents | Index |
Alpha example:
30040;B (1) 30070;B (2) ;B 1 00030040 2 00030070 ;P (3) Brk 1 at 00030040 00030040! LDA R27,#XFFC8(R2) O (4) 00030044! BSR R26,#X00000A O (5) Brk 2 at 00030070 00030070! LDA SP,#XFFD0(SP) ;P (6) Step-over at 30048 00030048! LDQ R26,#X0048(R2) S (7) 0003004C! BIS R31,R31,R17 |
VAX example:
6D5;B (1) ;P (2) 1 BRK AT 000006D5 000006D5/CALLS #0C,@#7FFEDE00 ;P (3) PID= 0006 LOGINTIME= 12:50:29.45 2 BRK AT 00000699 00000699/BSBB 000006A2 ;P (4) 1 BRK AT 000006D5 000006D5/CALLS #0C,@#7FFEDE00 ;P (5) PID= 0007 LOGINTIME= 12:50:37.08 2 BRK AT 00000699 00000699/BSBB 000006A2 O (6) 1 BRK AT 000006D5 000006D5/CALLS #0C,@#7FFEDE00 ;P (7) PID= 0008 LOGINTIME= 12:50:45.64 STEPOVER BRK AT 0000069B (8) 0000069B/BRB X1+047A |
Executes one instruction and displays the next. If the executed instruction is a call to a subroutine, it steps into the subroutine and displays the next instruction to be executed in the subroutine.
S
The Step Instruction command executes one instruction and displays the next instruction (in instruction mode) and its address. Use this command to single-step instructions, including single-stepping all instructions in subroutines. If you want to exclude single-stepping instructions in subroutines, use the O command.The instruction displayed has not yet been executed. This command sets a flag to change the display mode to instruction mode. Any subsequent Close Current Location, Open Next (LINEFEED) commands and Open and Display Indirect Location (TAB) commands will display locations as machine instructions. The Open Location and Display Contents (/) command clears the flag, causing the display mode to revert to longword, hexadecimal mode.
On I64, if the instruction is a br.call instruction, Step moves to the subroutine called by these instructions and displays the first instruction within the subroutine.
On Alpha, if the instruction being executed is a JSR or BSR instruction, Step moves to the subroutine called by these instructions and displays the first instruction within the subroutine.
Note
If DELTA/XDELTA does not have write access to the target of a JSR instruction, you cannot use the S or ;P command at the JSR instruction. First, you must use the O command; then you can use the S or ;P command.On VAX, if the instruction being executed is a BSBB, BSBW, JSB, CALLG, or CALLS instruction, Step moves to the subroutine called by these instructions and displays the first instruction within the subroutine.
On Alpha and VAX, in general, you move to the instruction where you want to start single-step execution by placing a breakpoint at that instruction and typing ;P. Then press S to execute the first instruction and display the next one.
I64 example:
X0+00000061! mov r52 = b0 S (1) X0+00000062! mov r40 = r1 S (2) X0+00000070! st8 [r12] = r0 ;; (3)
- Program execution has been stopped at base register X0 plus offset 0000061. The instruction at this address is a Move Branch Register. Step execution is continued using the S command.
- Program execution is now stopped at base register X0 plus offset 0000062. The instruction at this address is a Move Application Register. Step execution is then continued using the S command.
- The instruction at offset 0000070 is displayed.
Alpha example:
0003003C! BLBC R0,#X000006 S (1) 00030040! LDQ R16,#X0050(R2) S (2) 00030044! BIS R31,R31,R17 S (3) 00030048! LDQ R26,#X0040(R2)
- Step program execution is started at address 3003C. The instruction at 3003C is a conditional branch instruction. Step execution is continued using the S command.
- Because the condition (BLBC) was not met, program execution continued at the next instruction at address 30040. Had the branch been taken, execution would have continued at address 30058. The second S command causes the LDQ instruction to be executed.
- The instruction at address 30044 is displayed. The S command is executed.
OpenVMS VAX example:
00000690/CMPL R0,#000009A8 S (1) 00000697/BEQL 0000069D S (2) 00000699/BSBB 000006A2 S (3) 000006A2/PUSHL R2 (4)
- Step program execution is started at address 690. The instruction at 690 is executed and the next instruction is displayed. Step execution is continued using S.
- At address 697, there is a branch instruction to the instruction at address 69D. However, because the condition (BEQL) is not met, program execution continues at the next instruction. The next S command is executed.
- At address 699, there is a branch instruction to the instruction at address 6A2, a subroutine. The next S command is executed.
- Program execution moves to the subroutine.
This appendix gives an example of how you would use DELTA to debug a program executing on OpenVMS I64. The example C program named LOG uses the system service SYS$GETJPIW to obtain the PID, process name, and login time of each process. To run the example program without error, you need WORLD privilege.
Although this example debugging session demonstrates using the DELTA debugger, you could use most of the commands in the example in an XDELTA debugging session as well. |
This appendix consists of two sections:
This section shows the listing file for the C program, LOG, in two parts:
See Section A.2 for the corresponding sample debugging session using this program.
A.1.1 Source Listing for I64 Debugging Example
Example A-1 shows the C source code for the example file, LOG.
Example A-1 Listing File for LOG: C Source Code |
---|
1 #include <descrip.h> 973 #include <jpidef.h> 1378 #include <ssdef.h> 5641 #include <starlet.h> 19024 #include <stdio.h> 20606 #include <stdlib.h> 22406 22407 void print_line(unsigned long int pid, 22408 char *process_name, 22409 unsigned long int *time_buffer); 22410 22411 typedef struct { 22412 unsigned short int il3_buffer_len; 22413 unsigned short int il3_item_code; 22414 void *il3_buffer_ptr; 22415 unsigned short int *il3_return_len_ptr; 22416 } item_list_3; 22417 22418 #define NUL '\0' 22419 22420 main(void) 22421 { 22422 static char name_buf[16]; 22423 static unsigned long int pid, time_buf[2]; 22424 static unsigned short int name_len; 22425 22426 unsigned short int pidadr[2] = {-1, -1}; 22427 unsigned long int ss_sts; 22428 item_list_3 jpi_itmlst[] = { 22429 /* Get login time */ 22430 { sizeof(time_buf), 22431 JPI$_LOGINTIM, 22432 (void *) time_buf, 22433 NULL 22434 }, 22435 22436 /* Get process name */ 22437 { sizeof(name_buf) - 1, 22438 JPI$_PRCNAM, 22439 (void *) name_buf, 22440 &name_len 22441 }, 22442 22443 /* Get process ID (PID) */ 22444 { sizeof(pid), 22445 JPI$_PID, 22446 (void *) &pid, 22447 NULL 22448 }, 22449 22450 /* End of list */ 22451 { 0, 22452 0, 22453 NULL, 22454 NULL 22455 } 22456 }; 22457 22458 /* 22459 * While there's more GETJPI information to process and a catastrophic 22460 * error has not occurred then 22461 * If GETJPI was successful then 22462 * NUL terminate the process name string and 22463 * print the information returned by GETJPI 22464 */ 22465 22466 while((ss_sts = sys$getjpiw(0, &pidadr, 0, &jpi_itmlst, 0, 0, 0)) != SS$_NOMOREPROC && 22467 ss_sts != SS$_BADPARAM && 22468 ss_sts != SS$_ACCVIO) { 22469 22470 if (ss_sts == SS$_NORMAL) { 22471 *(name_buf + name_len) = NUL; 22472 print_line(pid, name_buf, time_buf); 22473 } 22474 } 22475 exit(EXIT_SUCCESS); 22476 } 22477 22478 void print_line(unsigned long int pid, 22479 char *process_name 22480 unsigned long int *time_buffer) 22481 { 22482 static char ascii_time[12]; 22483 22484 struct dsc$descriptor_s time_dsc = { 22485 sizeof(ascii_time) - 1, 22486 DSC$K_DTYPE_T, 22487 DSC$K_CLASS_S, 22488 ascii_time 22489 1 22490 unsigned short int time_len; 22491 22492 /* 22493 Convert the logged in time to ASCII and NUL terminate it 22494 */ 22495 sys$asctim(&time_len, &time_dsc, time_buffer, 1); 22496 *(ascii_time + time_len) = NUL; 22497 22498 /* 22499 Output the PID, process name and logged in time 22500 */ 22501 printf("\n\tPID= %08.8X\t\tPRCNAM= %s\tLOGINTIM= %s", 22502 pid, 22503 process_name, 22504 ascii_time); 22505 22506 return; 22507 } |
Example A-2 through Example A-4 show machine code listings for the procedures in the example program, LOG.
Example A-2 Listing File for LOG: Machine Code_MAIN Procedure |
---|
.psect $CODE$, CON, LCL, SHR, EXE, NOWRT, NOVEC, NOSHORT .proc __MAIN .align 32 .global __MAIN .personality DECC$$SHELL_HANDLER .handlerdata __MAIN: // 02242 { .mii 002C00F2EB40 0000 alloc r45 = rspfs, 6, 9, 8, 0 010800C00080 0001 mov r2 = sp // r2 = r12 0120000A0380 0002 mov r14 = 80 ;; } { .mmi 010028E183C0 0010 sub r15 = sp, r14 ;; // r15 = r12, r14 0080C0F00380 0011 ld8 r14 = [r15] 010800F00300 0012 mov sp = r15 ;; // r12 = r15 } { .mii 000008000000 0020 nop.m 0 000188000B00 0021 mov r44 = rp // r44 = br0 010800100B80 0022 mov r46 = gp ;; // r46 = r1 } . . . { .mii 010802E00040 0100 mov gp = r46 // r1 = r46 00015405A000 0101 mov.i rspfs = r45 000E00158000 0102 mov rp = r44 ;; // br0 = r44 } { .mbb 010800CA0300 0110 adds sp = 80, sp // r12 = 80, r12 000108001100 0111 br.ret.sptk.many rp // br0 004000000000 0112 nop.b 0 ;; } .endp __MAIN Routine Size: 288 bytes, Routine Base: $CODE$ + 0000 |
Example A-3 Listing File for LOG: Machine Code MAIN Procedure |
---|
.proc MAIN .align 32 .global MAIN MAIN: // 022420 { .mii 002C00A22A00 0120 alloc r40 = rspfs, 0, 10, 7, 0 010800C00080 0121 mov r2 = sp // r2 = = r12 012000080380 0122 mov r14 = 64 ;; } { .mmi 010028E183C0 0130 sub r15 = sp, r14 ;; // r5 = r12, r14 0080C0F00380 0131 ld8 r14 = [r15] 010800F00300 0132 mov sp = r15 ;; // r12 = r15 } { .mii 000008000000 0140 nop.m 0 0001880009C0 0141 mov r39 = rp // r39 = br0 010800100A40 0142 mov r41 = gp ;; // r41 = r1 } . . . { .mbb 01C4321401C0 0280 cmp4.eq pr7, pr6 = ss_sts, r33 // pr7, pr6 = r32, r33 008600018007 0281 (pr7) br.cond.dpnt.many L$12 004000000000 0282 nop.b 0 ;; } . . . { .mib 0080C2B00AC0 0320 ld8.mov out1 = [r43], name_buf 012000100B00 0321 add out2 = @gprel(time_buf), gp // r44 = @gprel(time_buf), r1 00A000001000 0322 br.call.sptk.many rp = PRINT_LINE ;; // br0 = PRINT_LINE } { .bbb 0091FFFDD000 0330 br.sptk.many L$10 // 022473 004000000000 0331 nop.b 0 004000000000 0332 nop.b 0 ;; } . . . { .mii 000008000000 0370 nop.m 0 000E0014E000 0371 mov rp = r39 // br0 = r39 010800C80300 0372 adds sp = 64, sp ;; // r12 = 64, r12 } { .bbb 000108001100 0380 br.ret.sptk.many rp // br0 004000000000 0381 nop.b 0 004000000000 0382 nop.b 0 ;; } .endp MAIN Routine Size: 624 bytes, Routine Base: $CODE$ + 0120 |
Example A-4 Listing File for LOG: Machine Code PRINT_LINE Procedure |
---|
.proc PRINT_LINE .align 32 .global PRINT_LINE PRINT_LINE: // 022478 { .mii 002C0091A9C0 0390 alloc r39 = rspfs, 3, 6, 4, 0 010800C00080 0391 mov r2 = sp // r2 = r12 012000020380 0392 mov r14 = 16 ;; } { .mmi 010028E183C0 03A0 sub r15 = sp, r14 ;; // r15 = r12, r14 0080C0F00380 03A1 ld8 r14 = [r15] 010800F00300 03A2 mov sp = r15 ;; // r12 = r15 } . . . { .mmi 012000100B00 0490 add out3 = @ltoffx(ascii_time), gp ;; //r44 = @ltoffx(ascii_time), r1 0080C2C00B00 0491 ld8.mov out3 = [r44], ascii_time 012000008640 0492 mov ai = 4 ;; // r25 = 4 } { .bbb 00A000001000 04A0 br.call.sptk.many rp = DECC$TXPRINTF // br0 = DECC$TXPRINTF 004000000000 04A1 nop.b 0 004000000000 04A2 nop.b 0 ;; } { .mii 010802800040 04B0 mov gp = r40 // r1 = r40 00015404E000 04B1 mov.i rspfs = r39 // 022506 000E0014C000 04B2 mov rp = r38 ;; // br0 = r38 } { .mbb 010800C20300 04C0 adds sp = 16, sp // r12 = 16, r12 000108001100 04C1 br.ret.sptk.many rp // br0 004000000000 04C2 nop.b 0 ;; } .endp PRINT_LINE Routine Size: 320 bytes, Routine Base: $CODE$ + 0390 |
The .MAP file for the sample program is shown in Example A-5. Only the Program Section Synopsis with the psect, module, base address, end address, and length are listed.
Example A-5 .MAP File for the Sample Program |
---|
+--------------------------+ ! Program Section Synopsis ! +--------------------------+ Psect Name Module/Image Base End Length ---------- ------------ ---- --- ------ $BSS$ 00010000 0001001F 00000020 ( 32.) LOG 00010000 0001001F 00000020 ( 32.) $CODE$ 00020000 0002061F 00000620 ( 1568.) LOG 00020000 000204CF 000004D0 ( 1232.) <Linker> 000204D0 0002061F 00000150 ( 336.) $LITERAL$ 00030000 00030058 00000059 ( 89.) LOG 00030000 00030058 00000059 ( 89.) $READONLY$ 00030060 00030087 00000028 ( 40.) LOG 00030060 00030087 00000028 ( 40.) $LINK$ 00040000 00040000 00000000 ( 0.) LOG 00040000 00040000 00000000 ( 0.) $LINKER UNWIND$ 00040000 00040047 00000048 ( 72.) LOG 00040000 00040047 00000048 ( 72.) $LINKER UNWINFO$ 00040048 000400B7 00000070 ( 112.) LOG 00040048 000400B7 00000070 ( 112.) .sbss 00050000 00050013 00000014 ( 20.) LOG 00050000 00050013 00000014 ( 20.) $LINKER SDATA$ 00060000 000600CF 000000D0 ( 208.) <Linker> 00060000 000600CF 000000D0 ( 208.) |
The DELTA debugging session on OpenVMS I64 for the sample program is shown in the three example segments that follow.
DELTA Debugging Session Example on I64 - Part 1
In the first part of the example session, DELTA is enabled and the LOG program is invoked. The example shows version information displayed by DELTA and the use of several key Delta commands, including !, ;B, and ;P.
The callout list following the example provides details for this example segment.
Example A-6 DELTA Debugging Session on I64 - Part 1 |
---|
$ DEFINE LIB$DEBUG SYS$SHARE:DELTA (1) $ RUN/DEBUG LOG (2) hp OpenVMS Industry Standard 64 DELTA Debugger (3) Brk 0 at 00020000 00020000! alloc r45 = ar.pfs, 0F, 08, 00 20000,1;X 00020000 X1 280! cmp4.eq p7, p6 = r32, r33 .;B (4) X1 322! br.call.sptk.many b0 = 0000070 ;; .;B (5) ;P Brk 1 at X1+00000280 (6) X1+00000280! cmp4.eq p7, p6 = r32, r33 R32/00000000 00000001 ;P Brk 2 at X1+00000322 X1+00000322! br.call.sptk.many b0 = 0000070 ;; O PID= 37E00401 PRCNAM= SWAPPER LOGINTIM= 00:00:00.00 (7) |
DELTA Debugging Session Example on I64 - Part 2
In the second part of the example session, program execution continues and DELTA stops at the next breakpoint and displays information. User interaction allows DELTA to continue subsequent breakpoints. Use of the O command is demonstated to halt program execution and step over a routine call.
The callout list following the example provides details for this example segment.
Example A-7 DELTA Debugging Session on I64 - Part 2 |
---|
X1+00000330! br.many 1FFFEE0 ;P (1) Brk 1 at X1+00000280 X1+00000280! cmp4.eq p7, p6 = r32, r33 ;P Brk 2 at X1+00000322 X1+00000322! br.call.sptk.many b0 = 0000070 ;; O (2) PID= 37E00407 PRCNAM= CLUSTER_SERVER LOGINTIM= 13:48:49.48 X1+00000330! br.many 1FFFEE0 ;P Brk 1 at X1+00000280 X1+00000280! cmp4.eq p7, p6 = r32, r33 ;B 1 X1+00000280 2 X1+00000322 0,1;B ;B 2 X1+00000322 ;P Brk 2 at X1+00000322 (3) X1+00000322! br.call.sptk.many b0 = 0000070 ;; O PID= 37E00408 PRCNAM= CONFIGURE LOGINTIM= 13:48:52.06 X1+00000330! br.many 1FFFEE0 ;P Brk 2 at X1+00000322 (4) X1+00000322! br.call.sptk.many b0 = 0000070 ;; O PID= 37E00409 PRCNAM= USB$UCM_SERVER LOGINTIM= 13:48:54.80 X1+00000330! br.many 1FFFEE0 ;P Brk 2 at X1+00000322 (5) X1+00000322! br.call.sptk.many b0 = 0000070 ;; X1 491! ld8 r44 = [r44] [Linefeed] (6) X1+00000492! mov r25 = 000004 ;; [Linefeed] X1+000004A0! br.call.sptk.many b0 = 0000150 .;B (7) ;B 1 X1+000004A0 2 X1+00000322 ;P (8) Brk 1 at X1+000004A0 (9) X1+000004A0! br.call.sptk.many b0 = 0000150 O PID= 37E0040A PRCNAM= LANACP LOGINTIM= 13:48:54.84 X1+000004B0! mov r1 = r40 ;P Brk 2 at X1+00000322 X1+00000322! br.call.sptk.many b0 = 0000070 ;; ;P Brk 1 at X1+000004A0 (10) X1+000004A0! br.call.sptk.many b0 = 0000150 O PID= 37E0040C PRCNAM= FASTPATH_SERVER LOGINTIM= 13:48:55.01 X1+000004B0! mov r1 = r40 ;P Brk 2 at X1+00000322 X1+00000322! br.call.sptk.many b0 = 0000070 ;; ;B 1 X1+000004A0 2 X1+00000322 0,2;B 0,1;B ;B ;P PID= 37E0040D PRCNAM= IPCACP LOGINTIM= 13:48:55.05 PID= 37E0040E PRCNAM= ERRFMT LOGINTIM= 13:48:55.14 PID= 37E0040F PRCNAM= CACHE_SERVER LOGINTIM= 13:48:55.19 PID= 37E00410 PRCNAM= OPCOM LOGINTIM= 13:48:55.24 PID= 37E00411 PRCNAM= AUDIT_SERVER LOGINTIM= 13:48:55.31 PID= 37E00412 PRCNAM= JOB_CONTROL LOGINTIM= 13:48:55.39 PID= 37E00414 PRCNAM= SECURITY_SERVER LOGINTIM= 13:48:55.84 PID= 37E00415 PRCNAM= ACME_SERVER LOGINTIM= 13:48:55.88 PID= 37E00416 PRCNAM= SMISERVER LOGINTIM= 13:49:02.26 PID= 37E0041E PRCNAM= NETACP LOGINTIM= 13:49:04.54 PID= 37E0041F PRCNAM= EVL LOGINTIM= 13:49:05.68 PID= 37E00420 PRCNAM= REMACP LOGINTIM= 13:49:13.39 PID= 37E00424 PRCNAM= TCPIP$INETACP LOGINTIM= 13:50:05.71 PID= 37E00425 PRCNAM= TCPIP$PORTM_1 LOGINTIM= 13:50:08.40 PID= 37E00426 PRCNAM= TCPIP$FTP_1 LOGINTIM= 13:50:08.77 PID= 37E0042A PRCNAM= LATACP LOGINTIM= 13:50:12.00 PID= 37E008E5 PRCNAM= SYSTEM LOGINTIM= 13:32:01.42 PID= 37E008E7 PRCNAM= JNELSON LOGINTIM= 13:41:17.48 $ |
Previous | Next | Contents | Index |