hp.com home products and services support and drivers solutions how to buy
cd-rom home
End of Jump to page title
HP OpenVMS systems
documentation

Jump to content


HP OpenVMS Debugger Manual

HP OpenVMS Debugger Manual


Previous Contents Index

For more information on debugging optimized programs, see Chapter 14.

If you are debugging a multiprocess program, the STEP command is executed in the context of the current process set. In addition, when debugging a multiprocess program, the way in which execution continues in your process depends on whether you entered a SET MODE [NO]INTERRUPT command or a SET MODE [NO]WAIT command. By default (SET MODE NOINTERRUPT), when one process stops, the debugger takes no action with regard to the other processes. Also by default (SET MODE WAIT), the debugger waits until all process in the current process set have stopped before prompting for a new command. See Chapter 15 for more information.

On VAX systems, the STEP/OVER command results in stepping into, not over, Fortran Run-Time Library routines. For more information, see Chapter 14.

Related commands:

CALL
EXIT
GO
SET BREAK/EXCEPTION
SET MODE [NO]INTERRUPT
SET PROCESS
(SET,SHOW) STEP

Examples

#1

DBG> SHOW STEP
step type: source, nosilent, by line, 
           over routine calls
DBG> STEP
stepped to SQUARES$MAIN\%LINE 4 
     4:         OPEN(UNIT=8, FILE='DATAFILE.DAT', STATUS='OLD')
DBG>
      

In this example, the SHOW STEP command identifies the default qualifiers currently in effect for the STEP command. In this case, the STEP command, without any parameters or qualifiers, executes the next line of source code. After the STEP command has completed, execution is suspended at the beginning of line 4.

#2

DBG> STEP 5
stepped to MAIN\%LINE 47 
    47:         SWAP(X,Y);
DBG>
      

This command executes the next 5 lines of source code. After the STEP command has completed, execution is suspended at the beginning of line 47.

#3

DBG> STEP/INTO
stepped to routine SWAP 
    23: procedure SWAP (A,B: in out integer) is
DBG> STEP
stepped to MAIN\SWAP\%LINE 24 
    24:    TEMP: integer := 0;
DBG> STEP/RETURN
stepped on return from MAIN\SWAP\%LINE 24 to MAIN\SWAP\%LINE 29 
    29: end SWAP;
DBG>
      

In this example, execution is paused at a call to routine SWAP, and the STEP/INTO command executes the program up to the beginning of the called routine. The STEP command executes the next line of source code. The STEP/RETURN command executes the rest of routine SWAP up to its RET instruction (that is, up to the point just prior to transferring control back to the calling routine).

#4

DBG> SET STEP INSTRUCTION
DBG> SHOW STEP
step type: source, nosilent, by instruction, 
           over routine calls
DBG> STEP
stepped to SUB1\%LINE 26: MOVL     S^#4,B^-20(FP) 
    26:    Z:integer:=4;
DBG>
      

In this example, the SET STEP INSTRUCTION command establishes /INSTRUCTION as the default STEP command qualifier. This is verified by the SHOW STEP command. The STEP command executes the next instruction. After the STEP command has completed, execution is suspended at the first instruction (MOVL) of line 26 in module SUB1.


STOP

Interrupts all specified processes that are running.

Format

STOP [process-spec[,...]


Parameters

process-spec

This parameter specifies the process set to be stopped. The default is the current process set. Use any of the following forms:
[%PROCESS_NAME] process-name The process name, if that name does not contain spaces or lowercase characters. The process name can include the asterisk (*) wildcard character.
[%PROCESS_NAME] " process-name " The process name, if that name contains spaces or lowercase characters. You can also use apostrophes (') instead of quotation marks (").
%PROCESS_PID process_id The process identifier (PID, a hexadecimal number).
[%PROCESS_NUMBER] process-number
(or %PROC process-number)
The number assigned to a process when it comes under debugger control. A new number is assigned sequentially, starting with 1, to each process. If a process is terminated with the EXIT or QUIT command, the number can be assigned again during the debugging session. Process numbers appear in a SHOW PROCESS display. Processes are ordered in a circular list so they can be indexed with the built-in symbols %PREVIOUS_PROCESS and %NEXT_PROCESS.
process-set-name A symbol defined with the DEFINE/PROCESS_SET command to represent a group of processes.
%NEXT_PROCESS The next process after the visible process in the debugger's circular process list.
%PREVIOUS_PROCESS The process previous to the visible process in the debugger's circular process list.
%VISIBLE_PROCESS The process whose stack, register set, and images are the current context for looking up symbols, register values, routine calls, breakpoints, and so on.

You can also use the asterisk (*) wildcard character to specify all processes.


Description

The STOP command interrupts the specified processes. You can use the STOP command in nowait mode to stop processes that are still running.

Examples

#1

all> SHOW PROCESS
 
 Number  Name          State            Current PC 
     1 DBGK$$2727282C  break    SERVER\
main\%LINE 18834 
     2 USER1_2         running          not available 
*    3 USER1_3         running          not available 
all> CLIENTS> STOP
all> show process 
 Number  Name          State            Current PC 
     1 DBGK$$2727282C  break    SERVER 
main<literal>\main\%LINE 18834 
     2 USER1_2         interrupted   0FFFFFFFF800F7A20 
*    3 USER1_3         interrupted   0FFFFFFFF800F7A20 
all> 
 
      

This command sequence first shows all processes, then stops the processes in process set clients. The last SHOW PROCESS command shows the new process states.


SYMBOLIZE

Converts a memory address to a symbolic representation, if possible.

Format

SYMBOLIZE address-expression[,...]


Parameters

address-expression

Specifies an address expression to be symbolized. Do not use the asterisk (*) wildcard character.

Description

If the address is a static address, it is symbolized as the nearest preceding symbol name, plus an offset. If the address is also a code address and a line number can be found that covers the address, the line number is included in the symbolization.

If the address is a register address, the debugger displays all symbols in all set modules that are bound to that register. The full path name of each such symbol is displayed. The register name itself ("%R5", for example) is also displayed.

If the address is a call stack location in the call frame of a routine in a set module, the debugger searches for all symbols in that routine whose addresses are relative to the frame pointer (FP) or the stack pointer (SP). The closest preceding symbol name plus an offset is displayed as the symbolization of the address. A symbol whose address specification is too complex is ignored.

On Alpha processors, the commands SYMBOLIZE procedure-code-address and SYMBOLIZE procedure-descriptor-address both display the path name of the routine, entry point, or Ada package specified by these addresses.

If the debugger cannot symbolize the address, a message is displayed.

Related commands:

EVALUATE/ADDRESS
SET MODE [NO]LINE
SET MODE [NO]SYMBOLIC
(SET,SHOW) MODULE
SHOW SYMBOL

Examples

#1

DBG> SYMBOLIZE %R5
address PROG\%R5: 
    PROG\X
DBG>
      

This example shows that the local variable X in routine PROG is located in register R5.

#2

DBG> SYMBOLIZE %HEX 27C9E3
address 0027C9E3: 
    MOD5\X
DBG>
      

This command directs the debugger to treat the integer literal 27C9E3 as a hexadecimal value and convert that address to a symbolic representation, if possible. The address converts to the symbol X in module MOD5.


TYPE

Displays lines of source code.

Format

TYPE [[module-name\]line-number[:line-number]
[,[module-name\]line-number[:line-number][,...]]]


Parameters

module-name

Specifies the module that contains the source lines to be displayed. If you specify a module name along with the line numbers, use standard pathname notation: insert a backslash (\) between the module name and the line numbers.

If you do not specify a module name, the debugger uses the current scope (as established by a previous SET SCOPE command, or the PC scope if you did not enter a SET SCOPE command) to find source lines for display. If you specify a scope search list with the SET SCOPE command, the debugger searches for source lines only in the module associated with the first named scope.

line-number

Specifies a compiler-generated line number (a number used to label a source language statement or statements).

If you specify a single line number, the debugger displays the source code corresponding to that line number.

If you specify a list of line numbers, separating each with a comma, the debugger displays the source code corresponding to each of the line numbers.

If you specify a range of line numbers, separating the beginning and ending line numbers in the range with a colon (:), the debugger displays the source code corresponding to that range of line numbers.

You can display all the source lines of a module by specifying a range of line numbers starting from 1 and ending at a number equal to or greater than the largest line number in the module.

After displaying a single line of source code, you can display the next line of that module by entering a TYPE command without a line number (that is, by entering TYPE and then pressing the Return key). You can then display the next line and successive lines by repeating this sequence, in effect, reading through your source program one line at a time.


Description

The TYPE command displays the lines of source code that correspond to the specified line numbers. The line numbers used by the debugger to identify lines of source code are generated by the compiler. They appear in a compiler-generated listing and in a screen-mode source display.

If you specify a module name with the TYPE command, the module must be set. Use the SHOW MODULE command to determine whether a particular module is set. Then use the SET MODULE command, if necessary.

In screen mode, the output of a TYPE command is directed at the current source display, not at an output or DO display. The source display shows the lines specified and any surrounding lines that fit in the display window.

Related commands:

EXAMINE/SOURCE
SET (BREAK,TRACE,WATCH)/[NO]SOURCE
SET MODE [NO]SCREEN
(SET,SHOW,CANCEL) SCOPE
SET STEP [NO]SOURCE
STEP/[NO]SOURCE

Examples

#1

DBG> TYPE 160
module COBOLTEST 
   160: START-IT-PARA.
DBG> TYPE
module COBOLTEST 
   161:         MOVE SC1 TO ES0.
DBG>
      

In this example, the first TYPE command displays line 160, using the current scope to locate the module containing that line number. The second TYPE command, entered without specifying a line number, displays the next line in that module.

#2

DBG> TYPE 160:163
module COBOLTEST 
   160: START-IT-PARA. 
   161:         MOVE SC1 TO ES0. 
   162:         DISPLAY ES0. 
   163:         MOVE SC1 TO ES1.
DBG>
      

This command displays lines 160 to 163, using the current scope to locate the module.

#3

DBG> TYPE SCREEN_IO\7,22:24
      

This command displays line 7 and lines 22 to 24 in module SCREEN_IO.


WAIT

Causes the debugger to wait until the target processes have stopped before prompting for the next command.

Format

WAIT


Description

When debugging multiprocess programs, the WAIT command causes the debugger to complete executing all process specified by the previous command before displaying a prompt to accept and execute another command.

Related commands:

STOP
SET MODE [NO]INTERRUPT
SET MODE [NO]WAIT

Example


all> 2,3> GO;WAIT
 
processes 2,3 
  break at CLIENT\main\%LINE 18814 
      18814:      status = sys$qiow (EFN$C_ENF,  mbxchan, 
                        IO$_READVBLKIO$M_WRITERCHECK, myiosb) 
process 1 
  break at SERVER\main\%LINE 18834 
      18834:             if ((myiosb.iosb$w_status ==  
                        SS$_NOREADER) && (pos_status != -1)) 
all>
 
      

This command sequence executes the target processes (in this case, 2 and 3), and the debugger waits until both processes reach breakpoints before prompting for the next command.


WHILE

Executes a sequence of commands while the language expression (Boolean expression) you have specified evaluates as true.

Format

WHILE Boolean-expression DO (command[;...])


Parameters

Boolean-expression

Specifies a language expression that evaluates as a Boolean value (true or false) in the currently set language.

command

Specifies a debugger command. If you specify more than one command, separate the commands with semicolons (;). At each execution, the debugger checks the syntax of any expressions in the commands and then evaluates them.

Description

The WHILE command evaluates a Boolean expression in the current language. If the value is true, the command list in the DO clause is executed. The command then repeats the sequence, reevaluating the Boolean expression and executing the command list until the expression is evaluated as false.

If the Boolean expression is false, the WHILE command terminates.

Related commands:

EXITLOOP
FOR
REPEAT

Example


DBG> WHILE (X .EQ. 0) DO (STEP/SILENT)
      

This command directs the debugger to keep stepping through the program until X no longer equals 0 (Fortran example).


Appendix A
Predefined Key Functions

When you start the debugger, certain predefined functions (commands, sequences of commands, and command terminators) are assigned to keys on the numeric keypad, to the right of the main keyboard. By using these keys you can enter certain commands with fewer keystrokes than if you were to type them at the keyboard. For example, pressing the COMMA key (,) on the keypad is equivalent to typing GO and then pressing the Return key. Terminals and workstations that have an LK201 keyboard have additional programmable keys compared to those on VT100 keyboards (for example, "Help" or "Remove"), and some of these keys are also assigned debugger functions.

To use function keys, keypad mode must be enabled (SET MODE KEYPAD). Keypad mode is enabled when you start the debugger. If you do not want keypad mode enabled, perhaps because the program being debugged uses the keypad for itself, you can disable keypad mode by entering the SET MODE NOKEYPAD command.

The keypad key functions that are predefined when you start the debugger are identified in summary form in Figure A-1. Table A-1, Table A-2, Table A-3, and Table A-4 identify all key definitions in detail. Most keys are used for manipulating screen displays in screen mode. To use screen mode commands, you must first enable screen mode by pressing the PF3 key (SET MODE SCREEN). In screen mode, to re-create the default layout of various windows, press the keypad key sequence BLUE-MINUS (PF4 followed by the MINUS key (--)).

To use the keypad keys to enter numbers rather than debugger commands, enter the command SET MODE NOKEYPAD.

Figure A-1 Keypad Key Functions Predefined by the Debugger---Command Interface


A.1 DEFAULT, GOLD, BLUE Functions

A given key typically has three predefined functions:

In Figure A-1, the DEFAULT, GOLD, and BLUE functions are listed within each key's outline, from top to bottom, respectively. For example, pressing keypad key KP0 enters the command STEP (DEFAULT function); pressing PF1 and then KP0 enters the command STEP/INTO (GOLD function); pressing PF4 and then KP0 enters the command STEP/OVER (BLUE function).

All command sequences assigned to keypad keys are terminated (executed immediately) except for the BLUE functions of keys KP2, KP4, KP6, and KP8. These unterminated commands are symbolized with a trailing ellipsis (...) in Figure A-1. To terminate the command, supply a parameter and then press Return. For example, to scroll down 12 lines:

  1. Press the PF4 key.
  2. Press keypad key KP2.
  3. Type :12 at the keyboard.
  4. Press the Return key.

A.2 Key Definitions Specific to LK201 Keyboards

Table A-1 lists keys that are specific to LK201 keyboards and do not appear on VT100 keyboards. For each key, the table identifies the equivalent command and, for some keys, an equivalent keypad key that you can use if you do not have an LK201 keyboard.

Table A-1 Key Definitions Specific to LK201 Keyboards
LK201 Key Command Sequence Invoked Equivalent
Keypad Key
F17 SET KEY/STATE=DEFAULT None
F18 SET KEY/STATE=MOVE None
F19 SET KEY/STATE=EXPAND None
F20 SET KEY/STATE=CONTRACT None
Help HELP KEYPAD SUMMARY None
Next Screen SCROLL/DOWN KP2
Prev Screen SCROLL/UP KP8
Remove DISPLAY/REMOVE %CURSCROLL None
Select SELECT/SCROLL %NEXTSCROLL KP3

A.3 Keys That Scroll, Move, Expand, Contract Displays

By default, keypad keys KP2, KP4, KP6, and KP8 scroll the current scrolling display. Each key controls a direction (down, left, right, and up, respectively). By pressing F18, F19, or F20, you can place the keypad in the MOVE, EXPAND, or CONTRACT states. When the keypad is in the MOVE state, you can use KP2, KP4, KP6, and KP8 to move the current scrolling display down, left, and so on. Similarly, in the EXPAND and CONTRACT states, you can use the four keys to expand or contract the current scrolling display. (See Figure A-1 and Table A-2. Alternative key definitions for VT100 keyboards are described later in this section.)

To scroll, move, expand, or contract a display:

  1. Press KP3 repeatedly, as needed, to select the current scrolling display from the display list.
  2. Press F17, F18, F19, or F20 to put the keypad in the DEFAULT (scroll), MOVE, EXPAND, or CONTRACT state, respectively.
  3. Press KP2, KP4, KP6, and KP8 to do the desired function. Use the PF1 (GOLD) and PF4 (BLUE) keys to control the amount of scrolling or movement.

Table A-2 Keys That Change the Key State
Key Description
PF1 Invokes the GOLD function of the next key you press.
PF4 Invokes the BLUE function of the next key you press.
F17 Puts the keypad in the DEFAULT state, enabling the scroll-display functions of KP2, KP4, KP6, and KP8. The keypad is in the DEFAULT state when you invoke the debugger.
F18 Puts the keypad in the MOVE state, enabling the move-display functions of KP2, KP4, KP6, and KP8.
F19 Puts the keypad in the EXPAND state, enabling the expand-display functions of KP2, KP4, KP6, and KP8.
F20 Puts the keypad in the CONTRACT state, enabling the contract-display functions of KP2, KP4, KP6, and KP8.

If you have a VT100 keyboard, you can simulate the effect of LK201 keys F17 to F20 by assigning the functions of those keys to other key sequences. You can make key assignments in a command procedure, such as your debugger initialization file (see init_sec). The following code contains key assignments that allow key sequences GOLD-KP9 and BLUE-KP9 (currently undefined) to mimic the effects of cycling through keys F17 to F20). When these key assignments are in effect, press GOLD-KP9 to put the keypad in the DEFAULT (scroll) state; press BLUE-KP9 repeatedly to cycle the keypad through the DEFAULT, MOVE, EXPAND, and CONTRACT states.


DEFINE/KEY/IF_STATE=(GOLD,MOVE_GOLD,EXPAND_GOLD,CONTRACT_GOLD)- 
 /TERMINATE KP9 "SET KEY/STATE=DEFAULT/NOLOG" 
DEFINE/KEY/IF_STATE=(BLUE)- 
 /TERMINATE KP9 "SET KEY/STATE=MOVE/NOLOG" 
DEFINE/KEY/IF_STATE=(MOVE_BLUE)- 
 /TERMINATE KP9 "SET KEY/STATE=EXPAND/NOLOG" 
DEFINE/KEY/IF_STATE=(EXPAND_BLUE)- 
 /TERMINATE KP9 "SET KEY/STATE=CONTRACT/NOLOG" 
DEFINE/KEY/IF_STATE=(CONTRACT_BLUE)- 
 /TERMINATE KP9 "SET KEY/STATE=DEFAULT/NOLOG" 


Previous Next Contents Index