|
HP OpenVMS systems documentation |
Previous | Contents | Index |
The built-in symbols %BIN, %DEC, %HEX, and %OCT can be used in address expressions and language expressions to specify that an integer literal that follows (or all integer literals in a parenthesized expression that follows) should be interpreted in binary, decimal, hexadecimal, or octal radix, respectively. Use these radix built-in symbols only with integer literals. For example:
DBG> EVALUATE/DEC %HEX 10 16 DBG> EVALUATE/DEC %HEX (10 + 10) 32 DBG> EVALUATE/DEC %BIN 10 2 DBG> EVALUATE/DEC %OCT (10 + 10) 16 DBG> EVALUATE/HEX %DEC 10 0A DBG> SET RADIX DECIMAL DBG> EVALUATE %HEX 20 + 33 ! Treat 20 as hexadecimal, 33 as decimal 65 ! Resulting value is decimal DBG> EVALUATE %HEX (20+33) ! Treat both 20 and 33 as hexadecimal 83 DBG> EVALUATE %HEX (20+ %OCT 10 +33) ! Treat 20 and 33 as 91 ! hexadecimal and 10 as octal DBG> SYMBOLIZE %HEX 27C9E3 ! Symbolize a hexadecimal address DBG> DEPOSIT/INST %HEX 5432 = 'MOVL ^O%DEC 222, R1' DBG> ! Treat address 5432 as hexadecimal, and operand 222 as decimal |
The following built-in symbols enable you to specify program locations and the current value of an entity:
Symbol | Description |
---|---|
%CURLOC
. (period) |
Current logical entity---the program location last referenced by an EXAMINE, DEPOSIT, or EVALUATE/ADDRESS command. |
%NEXTLOC
Return key |
Logical successor of the current entity---the program location that logically follows the location last referenced by an EXAMINE, DEPOSIT, or EVALUATE/ADDRESS command. Because the Return key is a command terminator, it can be used only where a command terminator is appropriate (for example, immediately after EXAMINE, but not immediately after DEPOSIT or EVALUATE/ADDRESS). |
%PREVLOC
^ (circumflex) |
Logical predecessor of current entity---the program location that logically precedes the location last referenced by an EXAMINE, DEPOSIT, or EVALUATE/ADDRESS command. |
%CURVAL
\ (backslash) |
Value last displayed by an EVALUATE or EXAMINE command, or deposited by a DEPOSIT command. These two symbols are not affected by an EVALUATE/ADDRESS command. |
In the following example, the variable WIDTH is examined; the value 12 is then deposited into the current location (WIDTH); this is verified by examining the current location:
DBG> EXAMINE WIDTH MOD\WIDTH: 7 DBG> DEPOSIT . = 12 DBG> EXAMINE . MOD\WIDTH: 12 DBG> EXAMINE %CURLOC MOD\WIDTH: 12 DBG> |
In the next example, the next and previous locations in an array are examined:
DBG> EXAMINE PRIMES(4) MOD\PRIMES(4): 7 DBG> EXAMINE %NEXTLOC MOD\PRIMES(5): 11 DBG> EXAMINE [Return] ! Examine next location MOD\PRIMES(6): 13 DBG> EXAMINE %PREVLOC MOD\PRIMES(5): 11 DBG> EXAMINE ^ MOD\PRIMES(4): 7 DBG> |
Note that using the Return key to signify the logical successor does
not apply to all contexts. For example, you cannot press the Return key
after typing the command DEPOSIT to indicate the next location, but you
can always use the symbol %NEXTLOC for that purpose.
B.3.7 Using Symbols and Operators in Address Expressions
The following list describes the symbols and operators that you can use in address expressions. A unary operator has one operand. A binary operator has two operands.
The following examples show the use of built-in symbols and operators in address expressions.
The following command sets a tracepoint at line 26 of the module in which execution is currently suspended:
DBG> SET TRACE %LINE 26 |
The next command displays the source line associated with line 47:
DBG> EXAMINE/SOURCE %LINE 47 module MAIN 47: procedure SWAP(X,Y: in out INTEGER) is DBG> |
The next command sets a breakpoint at label 10 of module MOD4:
DBG> SET BREAK MOD4\%LABEL 10 |
The following command displays the value of the variable COUNT that is declared in routine ROUT2 of module MOD4. The backslash (\) pathname delimiter separates the pathname elements:
DBG> EXAMINE MOD4\ROUT2\COUNT MOD4\ROUT2\COUNT: 12 DBG> |
The following command sets a breakpoint on line 26 of the module QUEUMAN:
DBG> SET BREAK QUEUMAN\%LINE 26 |
The following command displays the value of the global symbol X:
DBG> EXAMINE \X |
The order in which the debugger evaluates the elements of an address expression is similar to that used by most programming languages. The order is determined by the following three factors, listed in decreasing order of precedence (first listed have higher precedence):
The debugger operators are listed in decreasing order of precedence as follows:
For example, when evaluating the following expression, the debugger first adds the operands within parentheses, then divides the result by 4, then subtracts the result from 5:
5-(T+5)/4 |
The following command displays the value contained in the memory
location
X + 4 bytes:
DBG> EXAMINE X + 4 |
The following examples show the use of the contents-of operator. In the first example, the instruction at the current PC value is obtained (the instruction whose address is contained in the PC and which is about to execute):
DBG> EXAMINE .%PC MOD\%LINE 5: PUSHL S^#8 DBG> |
In the next example, the source line at the PC value one level down the call stack is obtained (at the call to routine SWAP):
DBG> EXAMINE/SOURCE .1\%PC module MAIN MAIN\%LINE 134: SWAP(X,Y); DBG> |
For the next example, the value of the pointer variable PTR is 7FF00000 hexadecimal, the address of an entity that you want to examine. The value of this entity is 3FF00000 hexadecimal. The following command shows how to examine the entity:
DBG> EXAMINE/LONG .PTR 7FF00000: 3FF00000 DBG> |
In the next example, the contents-of operator (at sign or period) is used with the current location operator (period) to examine a linked list of three quadword-integer pointer variables (identified as L1, L2, and L3 in the following figure). P is a pointer to the start of the list. The low longword of each pointer variable contains the address of the next variable; the high longword of each variable contains its integer value (8, 6, and 12, respectively).
DBG> SET TYPE QUADWORD; SET RADIX HEX DBG> EXAMINE .P ! Examine the entity whose address ! is contained in P. 00009BC2: 00000008 00009BDA ! High word has value 8, low word ! has address of next entity (9BDA). DBG> EXAMINE @. ! Examine the entity whose address ! is contained in the current entity. 00009BDA: 00000006 00009BF4 ! High word has value 6, low word ! has address of next entity (9BF4). DBG> EXAMINE .. ! Examine the entity whose address ! is contained in the current entity. 00009BF4: 0000000C 00000000 ! High word has value 12 (dec.), low word ! has address 0 (end of list). |
The following example shows how to use the bit-field operator. For example, to examine the address expression X_NAME starting at bit 3 with a length of 4 bits and no sign extension, enter the following command:
DBG> EXAMINE X_NAME <3,4,0> |
The following built-in symbols enable you to obtain information about the current exception and use that information to qualify breakpoints or tracepoints:
Symbol | Description |
---|---|
%EXC_FACILITY | Name of facility that issued the current exception |
%EXC_NAME | Name of current exception |
%ADAEXC_NAME | Ada exception name of current exception (for Ada programs only) |
%EXC_NUMBER | Number of current exception |
%EXC_SEVERITY | Severity code of current exception |
For example:
DBG> EVALUATE %EXC_NAME "FLTDIV_F" DBG> SET BREAK/EXCEPTION WHEN (%EXC_NAME = "FLTDIV_F") . . . DBG> EVALUATE %EXC_NUMBER 12 DBG> EVALUATE/CONDITION_VALUE %EXC_NUMBER %SYSTEM-F-ACCVIO, access violation at PC !XL, virtual address !XL DBG> SET BREAK/EXCEPTION WHEN (%EXC_NUMBER = 12) |
The conditional expressions in the WHEN clauses are language-specific.
B.3.9 Specifying the Current, Next, and Previous Scope on the Call Stack
You can use the following built-in symbols to obtain and manipulate the scope for symbol lookup and for source or instruction display relative to the routine call stack:
Built-in Symbol | Description |
---|---|
%CURRENT_SCOPE_ENTRY | The call frame that the debugger is currently using as reference when displaying source code or decoded instructions, or when searching for symbols. By default, this is call frame 0. |
%NEXT_SCOPE_ENTRY | The next call frame down the call stack from the call frame denoted by %CURRENT_SCOPE_ENTRY. |
%PREVIOUS_SCOPE_ENTRY | The next call frame up the call stack from the call frame denoted by %CURRENT_SCOPE_ENTRY. |
These symbols return integer values that denote a call frame on the call stack. Call frame 0 denotes the routine at the top of the stack, where execution is suspended. Call frame 1 denotes the calling routine, and so on.
For example, the following command specifies that the debugger search for symbols starting with the scope denoted by the next routine down the call stack (rather than starting with the routine at the top of the call stack):
DBG> SET SCOPE/CURRENT %NEXT_SCOPE_ENTRY |
On VAX processors, you can use the debugger with programs written in the following Compaq languages:
Ada | BASIC | BLISS | C |
C++ | COBOL | DIBOL | Fortran |
MACRO-32 | Pascal | PL/I | RPG II |
SCAN |
On Alpha processors, you can use the debugger with programs written in the following Compaq languages:
Ada | BASIC | BLISS | C |
C++ | COBOL | Fortran | MACRO-32 1 |
MACRO-64 | Pascal | PL/I |
On Intel® Itanium® processors, you can use the debugger with programs written in the following HP languages:
Assembler (IAS) | BASIC | BLISS | C |
C++ | COBOL | Fortran | MACRO-32 1 |
IMACRO | PASCAL | ||
Assembler (IAS) | BASIC | BLISS | C |
C++ | COBOL | Fortran | MACRO-32 1 |
IMACRO | PASCAL |
The debugger recognizes the syntax, data typing, and scoping rules of each language. It also recognizes each language's operators and expression syntax. Therefore, when using debugger commands you can specify variables and other program entities as you might in the source code of the program. You can also compute the value of a source-language expression using the syntax of that language.
This appendix describes debugging techniques that are common to most of the supported languages. The help topics provide further information specific to each language:
For more information about language-specific debugger support, refer to the documentation furnished with a particular language.
If your program is written in more than one language, you can change the debugging context from one language to another during a debugging session. Use the SET LANGUAGE command with the keyword corresponding to your language choice.
On VAX processors, you can specify one of the following keywords:
ADA | BASIC | BLISS | C |
C++ | COBOL | DIBOL | FORTRAN |
MACRO | PASCAL | PLI | RPG |
SCAN | UNKNOWN |
On Alpha processors, you can specify one of the following keywords:
ADA | AMACRO | BASIC | BLISS |
C | C++ | COBOL | FORTRAN |
MACRO | MACRO64 | PASCAL | UNKNOWN |
On Intel® Itanium® processors, you can specify on of the following keywords:
AMACRO | BASIC | BLISS | C |
C++ | COBOL | Fortran | PASCAL |
UNKNOWN |
When you are debugging a program written in an unsupported language,
enter the SET LANGUAGE UNKNOWN command. To maximize the usability of
the debugger with unsupported languages, this setting causes the
debugger to accept a large set of data formats and operators, including
some that might be specific to only a few supported languages. For
information about the operators and constructs that are recognized when
the language is set to UNKNOWN, type Help Language_UNKNOWN.
C.2 Ada
The following subtopics describe debugger support for Ada. For
information specific to Ada tasking programs, see also Chapter 16.
C.2.1 Ada Names and Symbols
The following subtopics describe debugger support for Ada names and symbols, including predefined attributes.
Note that parts of names may be language expressions---for example, attributes such as 'FIRST or 'POS. This affects how you use the EXAMINE, EVALUATE, and DEPOSIT commands with such names. For examples of enumeration types, type Help Specifying_Attributes_with_Enumeration_Types.
Previous | Next | Contents | Index |