HP OpenVMS Systems Documentation

Content starts here

HP OpenVMS System Analysis Tools Manual


Previous Contents Index

11.12 Sample System Code Debugging Session

This section provides a sample session that shows the use of some OpenVMS debugger commands as they apply to SCD. The examples in this session show how to work with C code that has been linked into the SYSTEM_DEBUG execlet. It is called as an initialization routine for SYSTEM_DEBUG.

To reproduce this sample session, the host system needs access to the SYSTEM_DEBUG.DSF matching the SYSTEM_DEBUG.EXE file on your target system, and to the source file C_TEST_ROUTINES.C, which is available in SYS$EXAMPLES. The target system is booted with the boot flags 0, 8004, so it stops at an initial breakpoint. The system disk is DKB200, and the network device is ESA0 in the Alpha examples and EIA0 in the Integrity server examples.

Note that the example displays from Example 11-5 onwards are all taken from an OpenVMS Integrity server system. On an OpenVMS Alpha system, some of the output is different, but the commands entered are the same on both platforms, except in one case, as noted in the accompanying text.

Example 11-1 Booting an Alpha Target System

 
>>> b -fl 0,8004 dkb200,esa0 
INIT-S-CPU... 
INIT-S-RESET_TC... 
INIT-S-ASIC... 
INIT-S-MEM... 
INIT-S-NVR... 
INIT-S-SCC... 
INIT-S-NI... 
INIT-S-SCSI... 
INIT-S-ISDN... 
INIT-S-TC0... 
AUDIT_BOOT_STARTS ... 
AUDIT_CHECKSUM_GOOD 
AUDIT_LOAD_BEGINS 
AUDIT_LOAD_DONE 
 
%SYSBOOT-I-GCTFIL, Using a configuration file to boot as a Galaxy instance. 
 
 
    OpenVMS (TM) Alpha Operating System, Version V8.3 
    © Copyright 1976-2006 Hewlett-Packard Development Company, L.P. 
 
DBGTK: Initialization succeeded.  Remote system debugging is now possible. 
 
DBGTK: Waiting at breakpoint for connection from remote host. 

A sample Integrity server Boot Menu follows (long lines wrapped for clarity).

Example 11-2 Booting an Integrity server Target System

 
        Please select a boot option 
 
    EFI Shell [Built-in] 
    PESOS - X8.2-AHI (Topaz BL2) on $1$DGA3890:[SYS2.] 
    PESOS - X8.2-AHI (Topaz BL2) on $1$DGA3890:[SYS2.] sysboot 
    PESOS - E8.2-ADH (Topaz BL1) on $1$DGA3891:[SYS2.] 
    PESOS - E8.2-ADH (Topaz BL1) on $1$DGA3891:[SYS2.] sysboot 
    Boot Option Maintenance Menu 
    System Configuration Menu 
 
  Select the "EFI Shell [Built-in]" 
 
        Loading.: EFI Shell [Built-in] 
        EFI Shell version 1.10 [14.61] 
        Device mapping table 
 
         fs0   : Acpi(HWP0002,100)/Pci(1|1)/Scsi(Pun0,Lun0)/HD(Part2, 
                 SigB3A4A931-1F2A-11D8-9EA1-AA000400FEFF) 
         fs1   : Acpi(HWP0002,100)/Pci(1|1)/Scsi(Pun2,Lun0)/HD(Part1, 
                 SigF7B864C3) 
         fs2   : Acpi(HWP0002,300)/Pci(1|0)/Fibre(WWN50001FE10011B15D, 
                 Lun2200)/HD(Part1,Sig51C7BEE1-070B-11D9-8099-AA000400FEFF) 
         fs3   : Acpi(HWP0002,300)/Pci(1|0)/Fibre(WWN50001FE10011B15D, 
                 Lun2200)/HD(Part4,Sig51C7BEE0-070B-11D9-809A-AA000400FEFF) 
         . 
         . 
         . 
 
 
        Shell> 
 
  Select the desired device/partion: 
 
        Shell> fs1: 
        fs1:\> 

Use the utilities in \efi\vms. Use vms_show to list the devices and vms_set to set ethernet device (debug_dev), if necessary. Note that this set is sticky so it only needs to be done once. Then load the operating system with the desired flags. Note that Alpha and Integrity servers use the same flags with the same meanings.


        fs1:\> dir \efi\vms 
        Directory of: fs1:\efi\vms 
 
          09/13/04  10:13a <DIR>          2,048  . 
          09/13/04  10:13a <DIR>          2,048  .. 
          09/13/04  10:13a <DIR>          2,048  tools 
          09/13/04  10:13a            3,101,184  ipb.exe 
          09/13/04  10:13a <DIR>          2,048  update 
          09/13/04  10:13a              846,336  vms_loader.efi 
          09/13/04  10:13a              244,224  vms_bcfg.efi 
          09/13/04  10:13a              218,112  vms_set.efi 
          09/13/04  10:13a              215,040  vms_show.efi 
                  5 File(s)   4,624,896 bytes 
                  4 Dir(s) 
 
        fs1:\> \efi\vms\vms_show device 
        VMS: EIA0 
        EFI: Acpi(000222F0,0)/Pci(3|0)/Mac(00306E39F77B) 
 
        VMS: DKB200 
        EFI: fs1: Acpi(000222F0,100)/Pci(1|1)/Scsi(Pun2,Lun0) 
 
        VMS: DKB0 
        EFI: fs0: Acpi(000222F0,100)/Pci(1|1)/Scsi(Pun0,Lun0) 
 
        VMS: EWA0 
        EFI: Acpi(000222F0,100)/Pci(2|0)/Mac(00306E3977C5) 
        . 
        . 
        . 
 

Set the debug_dev to one of the connected ethernet devices:


        fs1:\> \efi\vms\vms_set debug_dev eia0 
        VMS: EIA0               0-30-6E-39-F7-CF 
        EFI: Acpi(000222F0,0)/Pci(3|0)/Mac(00306E39F7CF) 
        fs1:\> \efi\vms\vms_show debug_dev 
        VMS: EIA0               0-30-6E-39-F7-CF 
        EFI: Acpi(000222F0,0)/Pci(3|0)/Mac(00306E39F7CF) 

Boot up the OS. In this example, the boot is with the SCD and initial (early) breakpoint flags, using root 2 (SYS2), that will vary with system setups:


        fs1:\> \efi\vms\vms_loader -flags "2,8004" 
 
            HP OpenVMS Industry Standard 64 Operating System, V8.3 
            © Copyright 1976-2006 Hewlett-Packard Development Company, L.P. 
 
        %EIA-I-BOOTDRIVER, Starting auto-negotiation 
        %EIA-I-BOOTDRIVER, Auto-negotiation selected 100BaseTX FDX 
 
        DBGTK: Initialization succeeded.  Remote system debugging is now possible. 
 
        DBGTK: Waiting at breakpoint for connection from remote host. 
 

The example continues by invoking the system code debugger's character-cell interface on the host system.

Example 11-3 Invoking the Alpha System Code Debugger

 
$ define dbg$decw$display " " 
$ debug/keep 
 
         OpenVMS Alpha Debug64 Version V8.3-003 
 
 
DBG> 
 

Example 11-4 Invoking the Integrity server System Code Debugger

 
$ define dbg$decw$display " " 
$ debug/keep 
 
         OpenVMS I64 Debug64 Version V8.3-003 
 
 
DBG> 
 

Use the CONNECT command to connect to the target system. In this example, the target system's default password is the null string, and the logical name DBGHK$IMAGE_PATH is used for the image path; so the command qualifiers /PASSWORD and /IMAGE_PATH are not being used. You may need to use them.

When you have connected to the target system, the DBG> prompt is displayed. Enter the SHOW IMAGE command to see what has been loaded. Because you are reaching a breakpoint early in the boot process, there are very few images. See Example 11-5. Notice that SYS$BASE_IMAGE has an asterisk next to it. This is the currently set image, and all symbols currently loaded in the debugger come from that image.

Example 11-5 Connecting to the Target System

DBG> connect %node_name TSTSYS 
%DEBUG-I-INIBRK, target system interrupted 
DBG> show image 
 image name                      set    base address         end address 
 
 ERRORLOG                        no     0000000000000000     FFFFFFFFFFFFFFFF 
 EXEC_INIT                       no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$ACPI                        no     0000000000000000     FFFFFFFFFFFFFFFF 
*SYS$BASE_IMAGE                  yes    0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$DKBTDRIVER                  no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$DKBTDRIVER                  no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$DKBTDRIVER                  no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$EGBTDRIVER                  no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$OPDRIVER                    no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$PKMBTDRIVER                 no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$PKMBTDRIVER                 no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$PKMBTDRIVER                 no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$PLATFORM_SUPPORT            no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$PUBLIC_VECTORS              no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$SRBTDRIVER                  no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_DEBUG                    no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_PRIMITIVES               no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_SYNCHRONIZATION          no     0000000000000000     FFFFFFFFFFFFFFFF 
 
 total images: 18 
DBG> 
 

Example 11-6 shows the target system's console display during the connect sequence. Note that for security reasons, the name of the host system, the user's name, and process ID are displayed.

Example 11-6 Target System Connection Display

 
 
DBGTK: Connection attempt from host HSTSYS  user GUEST       process 2E801C2F 
DBGTK: Connection attempt succeeded 
 
 

To set a breakpoint at the first routine in the C_TEST_ROUTINES module of the SYSTEM_DEBUG.EXE execlet, do the following:

  1. Load the symbols for the SYSTEM_DEBUG image with the DEBUG SET IMAGE command.
  2. Use the SET MODULE command to obtain the symbols for the module.
  3. Set the language to be C and set a breakpoint at the routine test_c_code.
    The language must be set because C is case sensitive and test_c_code needs to be specified in lowercase. The language is normally set to the language of the main image, in this example SYS$BASE_IMAGE.EXE. Currently that is not C.

Example 11-7 Setting a Breakpoint

DBG> set image system_debug 
%DEBUG-I-DYNLNGSET, setting language IMACRO 
DBG> show module 
module name                     symbols   language   size 
 
AUX_TARGET                      no        C             0 
BUFSRV_TARGET                   no        C             0 
BUGCHECK_CODES                  no        BLISS         0 
C_TEST_ROUTINES                 no        C             0 
LIB$$UNWIND_WEAK                no        BLISS         0 
LIB$EF                          no        IMACRO        0 
LIB$MALLOC                      no        C             0 
LIB$MALLOC_64                   no        C             0 
LINMGR_TARGET                   no        C             0 
OBJMGR                          no        C             0 
PLUMGR                          no        C             0 
POOL                            no        C             0 
PROTOMGR_TARGET                 no        C             0 
SOCMGR                          no        C             0 
SYS$DOINIT                      yes       IMACRO   122526 
TMRMGR_TARGET                   no        C             0 
 
total modules: 16 
 
DBG> set module c_test_routines 
DBG> show module c_test_routines 
module name                     symbols    size 
 
C_TEST_ROUTINES                 yes        5672 
 
total C modules: 1 
DBG> set language c 
DBG> show symbol test_c_code* 
routine C_TEST_ROUTINES\test_c_code 
routine C_TEST_ROUTINES\test_c_code2 
routine C_TEST_ROUTINES\test_c_code3 
routine C_TEST_ROUTINES\test_c_code4 
routine C_TEST_ROUTINES\test_c_code5 
DBG> set break test_c_code 
 

Now that the breakpoint is set, you can proceed and activate the breakpoint. When that occurs, the debugger tries to open the source code for that location in the same place as where the module was compiled. Because that is not the same place as on your system, you need to tell the debugger where to find the source code. This is done with the debugger's SET SOURCE command, which takes a search list as a parameter so you can make it point to many places.

Example 11-8 Finding the Source Code

 
 
DBG> set source/latest sys$examples,sys$library 
DBG> go 
break at routine C_TEST_ROUTINES\test_c_code 
   113:     x = c_test_array[0]; 
 

Now that the debugger has access to the source, you can put the debugger into screen mode to see exactly where you are and the code surrounding it.

Example 11-9 Using the Set Mode Screen Command

 
DBG> Set Mode Screen; Set Step Nosource 
 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
   105:     c_test_array[3] = test; 
   106:     return c_test_array[23]; 
   107: } 
   108: void test_c_code(void) 
   109: { 
   110:     int x,y; 
   111:     __int64 x64,y64; 
   112: 
-> 113:     x = c_test_array[0]; 
   114:     y = c_test_array[1]; 
   115:     x64 = c_test_array[2]; 
   116:     y64 = c_test_array[3]; 
   117:     c_test_array[14] = test_c_code2(x64+y64,x+y,x64+x,&y64); 
   118:     test_c_code4(); 
   119:     return; 
   120: } 
- OUT -output------------------------------------------------------------------- 
 
 
 
 
 
 
 
- PROMPT -error-program-prompt-------------------------------------------------- 
 
 
 
 
 
DBG> 
 

Now, you want to set another breakpoint inside the test_c_code3 routine. You use the debugger's SCROLL/UP command (8 on the keypad) to move to that routine and see that line 93 would be a good place to set the breakpoint. It is at a recursive call. Then you proceed to that breakpoint with the GO command.

Example 11-10 Using the SCROLL/UP DEBUG Command

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    80: void test_c_code4(void) 
    81: { 
    82:     int i,k; 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
    93:         subrtnCount = test_c_code3(subrtnCount); 
    94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
- OUT -output------------------------------------------------------------------- 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
- PROMPT -error-program-prompt-------------------------------------------------- 
 
 
 
DBG> Scroll/Up 
DBG> set break %line 93 
DBG> go 
DBG> 
 
 
 

When you reach that breakpoint, the source code display is updated to show where you currently are, which is indicated by an arrow. A message also appears in the OUT display indicating you reach the breakpoint at that line.

Example 11-11 Breakpoint Display

 
 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    82:     int i,k; 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
->  93:         subrtnCount = test_c_code3(subrtnCount); 
    94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
- OUT -output------------------------------------------------------------------- 
break at C_TEST_ROUTINES\test_c_code3\%LINE 93 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
- PROMPT -error-program-prompt-------------------------------------------------- 
 
 
 
DBG> Scroll/Up 
DBG> set break %line 93 
DBG> go 
DBG> 
 
 

Now you try the debugger's STEP command. The default behavior for STEP is STEP/OVER, unlike XDELTA and DELTA, which is STEP/INTO, so, normally you would expect to step to line 94 in the code. However, because you have a breakpoint inside test_c_code3 that is called at line 93, you will reach that event first.

Example 11-12 Using the Debug Step Command

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    82:     int i,k; 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
->  93:         subrtnCount = test_c_code3(subrtnCount); 
    94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
- OUT -output------------------------------------------------------------------- 
break at C_TEST_ROUTINES\test_c_code3\%LINE 93 
break at C_TEST_ROUTINES\test_c_code3\%LINE 93 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
- PROMPT -error-program-prompt-------------------------------------------------- 
 
 
DBG> 
DBG> set break %line 93 
DBG> go 
DBG> Step 
DBG> 
 
 

Now, you try a couple of other commands, EXAMINE and SHOW CALLS. The EXAMINE command allows you to look at all the C variables. Note that the C_TEST_ROUTINES module is compiled with the /NOOPTIMIZE switch which allows access to all variables. The SHOW CALLS command shows you the call sequence from the beginning of the stack. In this case, you started out in the image EXEC_INIT. (The debugger prefixes all images other than the main image with SHARE$ so it shows up as SHARE$EXEC_INIT. The suffix _CODE0 is appended if the executive image is sliced.)

Example 11-13 Using the Examine and Show Calls Commands

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    82:     int i,k; 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
->  93:         subrtnCount = test_c_code3(subrtnCount); 
    94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
- OUT -output------------------------------------------------------------------- 
C_TEST_ROUTINES\test_c_code3\subrtnCount:       8 
 module name     routine name     line           rel PC           abs PC 
*C_TEST_ROUTINES test_c_code3       93       0000000000000DC0 FFFFFFFF800BAFC0 
*C_TEST_ROUTINES test_c_code3       93       0000000000000DE0 FFFFFFFF800BAFE0 
*C_TEST_ROUTINES test_c_code2      104       0000000000000F40 FFFFFFFF800BB140 
*C_TEST_ROUTINES test_c_code       117       00000000000010B0 FFFFFFFF800BB2B0 
                 XDT$INIT                    00000000000015C0 FFFFFFFF880955C0 
*SYS$DOINIT      EXE$INITIALIZE   1973       0000000000000360 FFFFFFFF88094360 
 SHARE$EXEC_INIT_CODE0                       000000000005C240 FFFFFFFF803BB640 
 SHARE$EXEC_INIT_CODE0                       0000000000057F20 FFFFFFFF803B7320 
 SHARE$EXEC_INIT_CODE0                       0000000000047850 FFFFFFFF803A6C50 
 SHARE$EXEC_INIT_CODE0                       0000000000042E90 FFFFFFFF803A2290 
- PROMPT -error-program-prompt-------------------------------------------------- 
DBG> set break %line 93 
DBG> go 
DBG> Step 
DBG> examine subrtnCount 
DBG> show calls 
DBG> 
 
 

If you want to proceed because you are done debugging this code, first cancel all the breakpoints and then enter the GO command. Notice, however, that you do not keep running but receive a message that you have stepped to line 94. This happens because the STEP command used earlier never completed. It was interrupted by the breakpoint on line 93.

Note that the debugger remembers all step events and only removes them once they have completed.

Example 11-14 Canceling the Breakpoints

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
    93:         subrtnCount = test_c_code3(subrtnCount); 
->  94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
   105:     c_test_array[3] = test; 
- OUT -output------------------------------------------------------------------- 
 module name     routine name     line           rel PC           abs PC 
*C_TEST_ROUTINES test_c_code3       93       0000000000000DC0 FFFFFFFF800BAFC0 
*C_TEST_ROUTINES test_c_code3       93       0000000000000DE0 FFFFFFFF800BAFE0 
*C_TEST_ROUTINES test_c_code2      104       0000000000000F40 FFFFFFFF800BB140 
*C_TEST_ROUTINES test_c_code       117       00000000000010B0 FFFFFFFF800BB2B0 
                 XDT$INIT                    00000000000015C0 FFFFFFFF880955C0 
*SYS$DOINIT      EXE$INITIALIZE   1973       0000000000000360 FFFFFFFF88094360 
 SHARE$EXEC_INIT_CODE0                       000000000005C240 FFFFFFFF803BB640 
 SHARE$EXEC_INIT_CODE0                       0000000000057F20 FFFFFFFF803B7320 
 SHARE$EXEC_INIT_CODE0                       0000000000047850 FFFFFFFF803A6C50 
 SHARE$EXEC_INIT_CODE0                       0000000000042E90 FFFFFFFF803A2290 
stepped to C_TEST_ROUTINES\test_c_code3\%LINE 94 
- PROMPT -error-program-prompt-------------------------------------------------- 
DBG> Step 
DBG> examine subrtnCount 
DBG> show calls 
DBG> cancel break/all 
DBG> go 
DBG> 

The STEP/RETURN command, a different type of step command, single steps assembly code until it finds a return instruction. This command is useful if you want to see the return value for the routine, which is done here by examining the R0 register on Alpha, or the R8 register on Integrity servers.

For more information about using other STEP command qualifiers, see the HP OpenVMS Debugger Manual.

Example 11-15 Using the Step/Return Command

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
    93:         subrtnCount = test_c_code3(subrtnCount); 
->  94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
   105:     c_test_array[3] = test; 
- OUT -output------------------------------------------------------------------- 
*C_TEST_ROUTINES test_c_code3       93       0000000000000DE0 FFFFFFFF800BAFE0 
*C_TEST_ROUTINES test_c_code2      104       0000000000000F40 FFFFFFFF800BB140 
*C_TEST_ROUTINES test_c_code       117       00000000000010B0 FFFFFFFF800BB2B0 
                 XDT$INIT                    00000000000015C0 FFFFFFFF880955C0 
*SYS$DOINIT      EXE$INITIALIZE   1973       0000000000000360 FFFFFFFF88094360 
 SHARE$EXEC_INIT_CODE0                       000000000005C240 FFFFFFFF803BB640 
 SHARE$EXEC_INIT_CODE0                       0000000000057F20 FFFFFFFF803B7320 
 SHARE$EXEC_INIT_CODE0                       0000000000047850 FFFFFFFF803A6C50 
 SHARE$EXEC_INIT_CODE0                       0000000000042E90 FFFFFFFF803A2290 
stepped to C_TEST_ROUTINES\test_c_code3\%LINE 94 
stepped on return from C_TEST_ROUTINES\test_c_code3\%LINE 94 to C_TEST_ROUTINES\test_c_code3\%LINE 94+17 
C_TEST_ROUTINES\test_c_code3\%R8:       0 
- PROMPT -error-program-prompt-------------------------------------------------- 
DBG> show calls 
DBG> cancel break/all 
DBG> go 
DBG> step/return 
DBG> examine r8 
DBG> 
 

After you finish the SCD session, enter the GO command to leave this module. You will encounter another INI$BRK breakpoint at the end of EXEC_INIT. An error message is displayed indicating there are no source lines, because debug information on INI$BRK is not available.

Also notice that there is no message in the OUT display for this event. That is because INI$BRKs are special breakpoints that are handled as SS$_DEBUG signals. They are a method for the system code to break into the debugger and there is no real breakpoint in the code.

Enter the SHOW IMAGE command. You will see more images displayed as the boot path has progressed further.

Finally, enter GO, allowing the target system to boot completely, because there are no more breakpoints in the boot path. The debugger will wait for another event to occur.

Example 11-16 Using the Show Image Command

 
- SRC: module C_TEST_ROUTINES -scroll-source------------------------------------ 
    83:     for(k=0;k<1000;k++) 
    84:       { 
    85:          test_c_code5(&i); 
    86:       } 
    87:     return; 
    88: } 
    89: int test_c_code3(int subrtnCount) 
    90: { 
    91:     subrtnCount = subrtnCount - 1; 
    92:     if (subrtnCount != 0) 
    93:         subrtnCount = test_c_code3(subrtnCount); 
->  94:     return subrtnCount; 
    95: } 
    96: int test_c_code2(__int64 in64,int in32, __int64 test, __int64* pVar) 
    97: { 
    98:     c_test_array[5] = in64; 
    99:     c_test_array[6] = in32; 
   100:     if (c_test_array[9] > 0) 
   101:         *pVar =  (*pVar + c_test_array[17]) & c_test_array[9]; 
   102:     else 
   103:         *pVar = (*pVar + c_test_array[17]); 
   104:     c_test_array[7] = test_c_code3(10); 
   105:     c_test_array[3] = test; 
- OUT -output------------------------------------------------------------------- 
 SYS$UTC_SERVICES                no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$VM                          no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYS$XFCACHE_MON                 no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSDEVICE                       no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSGETSYI                       no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSLDR_DYN                      no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSLICENSE                      no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_DEBUG                    yes    0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_PRIMITIVES               no     0000000000000000     FFFFFFFFFFFFFFFF 
 SYSTEM_SYNCHRONIZATION          no     0000000000000000     FFFFFFFFFFFFFFFF 
 
 total images: 53 
- PROMPT -error-program-prompt-------------------------------------------------- 
DBG> go 
%DEBUG-I-INIBRK, target system interrupted 
%DEBUG-I-DYNIMGSET, setting image SYS$BASE_IMAGE 
%DEBUG-W-SCRNOSRCLIN, No source line for address: FFFFFFFF80000310 
DBG> show image 
DBG> go 
 


Previous Next Contents Index