When you enter an EXAMINE command, the debugger evaluates the address expression to yield a program location (a memory address or a register). The debugger then displays the value stored at that location as follows:
See Section 4.1.5 for more information about the types associated with symbolic and nonsymbolic address expressions.
By default, when displaying the value, the debugger identifies the address expression and its path name symbolically if symbol information is available. See Section 4.1.11 for more information about symbolizing addresses.
Use the debugger command DUMP to display the contents of memory, in a manner similar to that of the DCL command DUMP, in one of the following formats:
The command DUMP has the following syntax:
DUMP address-expression1[:address-expression2]
The default for address-expression2 is address-expression1. For example, the following command displays the current value of registers R16 through R25 in quadword format.
DBG> DUMP/QUADWORD R16:R25 0000000000000078 0000000000030038 8.......x....... %R16 000000202020786B 0000000000030041 A.......kx ... %R18 0000000000030140 0000000000007800 .x......@....... %R20 0000000000010038 0000000000000007 ........8....... %R22 0000000000000006 0000000000000000 ................ %R24 DBG>
You can use the command DUMP to display registers, variables, and arrays. The debugger makes no attempt to interpret the structure of arrays. The following qualifiers determine how the debugger displays output from the DUMP command:
Qualifier | Formats Output As |
---|---|
/BINARY | Binary integers |
/BYTE | One-byte integers |
/DECIMAL | Decimal integers |
/HEXADECIMAL | Hexadecimal integers |
/LONGWORD | Longword integers (length 4 bytes) |
/OCTAL | Octal integers |
/QUADWORD | Quadword integers (length 8 bytes) |
/WORD | Word integers (length 2 bytes) |
By default, the debugger displays examined entities that do not have a compiler-generated type as longwords.
For high-level languages, the DEPOSIT command is used mostly to assign a new value to a variable. The command is similar to an assignment statement in most programming languages, and has the following syntax:
DEPOSIT address-expression = language-expression
For example, the following DEPOSIT command assigns the value 23 to the integer variable X:
DBG> EXAMINE X MOD3\X: 17 DBG> DEPOSIT X = 23 DBG> EXAMINE X MOD3\X: 23 DBG>
The DEPOSIT command usually evaluates a language expression and deposits the resulting value into a program location denoted by an address expression.
When you enter a DEPOSIT command, the debugger does the following:
Note that the debugger might do type conversion during a deposit operation if the language rules allow it. For example, assume X is an integer variable. In the following example, the real value 2.0 is converted to the integer value 2, which is then assigned to X:
DBG> DEPOSIT X = 2.0 DBG> EXAMINE X MOD3\X: 2 DBG>
In general, the debugger tries to follow the assignment rules for the current language.
The symbols that are declared in your program (variable names, routine names, and so on) are symbolic address expressions. They denote memory addresses or registers. Symbolic address expressions (also called symbolic names in this chapter) have compiler-generated types, and the debugger knows the type and location that are associated with symbolic names. Section 4.1.11 explains how to obtain memory addresses and register names from symbolic names and how to symbolize program locations.
Symbolic names include the following categories:
Program locations that do not have a symbolic name are not associated with a compiler-generated type. To enable you to examine and deposit into such locations, the debugger associates them with the default type longword integer. If you specify a location that does not have a symbolic name, the EXAMINE command displays the contents of four bytes starting at the address specified and formats the displayed information as an integer value. In the following example, the memory address 926 is not associated with a symbolic name (note that the address is not symbolized when the EXAMINE command is executed). Therefore, the EXAMINE command displays the value at that address as a longword integer.
DBG> EXAMINE 926 926: 749404624 DBG>
By default you can deposit up to four bytes of integer data into a program location that does not have a symbolic name. This data is formatted as a longword integer. For example:
DBG> DEPOSIT 926 = 84 DBG> EXAMINE 926 926: 84 DBG>
Techniques for examining and depositing into locations that do not have a symbolic name are described in Section 4.5.
The EXAMINE and DEPOSIT commands accept type qualifiers (/ASCII:n, /BYTE, and so on) that enable you to override the type associated with a program location. This is useful if you want the contents of the location to be interpreted and displayed in another type, or if you want to deposit some value of a particular type into a location that is associated with another type. Techniques for overriding a type are described in Section 4.5.
A language expression consists of any combination of one or more symbols, literals, and operators that is evaluated to a single value in the syntax of the current language and in the current radix. (The current language and current radix are defined in Section 4.1.9 and Section 4.1.10, respectively.) Several debugger commands and constructs evaluate language expressions:
This discussion applies to all commands and constructs that evaluate language expressions, but it focuses on using the EVALUATE command.
The EVALUATE command evaluates one or more language expressions in the syntax of the current language and in the current radix and displays the resulting values. The command has the following syntax:
EVALUATE language-expression[,...]
One use of the EVALUATE command is to perform arithmetic calculations that might be unrelated to your program. For example:
DBG> EVALUATE (8+12)*6/4 30 DBG>
The debugger uses the rules of operator precedence of the current language when evaluating language expressions.
You can also evaluate language expressions that include variables and other constructs. For example, the following EVALUATE command subtracts 3 from the current value of the integer variable X, multiplies the result by 4, and displays the resulting value:
DBG> DEPOSIT X = 23 DBG> EVALUATE (X - 3) * 4 80 DBG>
However, you cannot evaluate a language expression that includes a function call. For example, if PRODUCT is a function that multiplies two integers, you cannot enter the EVALUATE PRODUCT(3,5) command. If your program assigns the returned value of a function to a variable, you can examine the resulting value of that variable.
If an expression contains symbols with different compiler generated types, the debugger uses the type-conversion rules of the current language to evaluate the expression. If the types are incompatible, a diagnostic message is issued. Debugger support for operators and other constructs in language expressions is listed in the debugger's online help for each language (type HELP Language).
The built-in symbol %CURVAL denotes the current value---the value last displayed by an EVALUATE or EXAMINE command or deposited by a DEPOSIT command. The backslash (\) also denotes the current value when used in that context. For example:
DBG> EXAMINE X MOD3\X: 23 DBG> EVALUATE %CURVAL 23 DBG> DEPOSIT Y = 47 DBG> EVALUATE \ 47 DBG>
You can use variables in language expressions in much the same way that you use them in the source code of your program.
Thus, the debugger generally interprets a variable used in a language expression as the current value of that variable, not the address of the variable. For example (X is an integer variable):
DBG> DEPOSIT X = 12 ! Assign the value 12 to X DBG> EXAMINE X ! Display the value of X MOD4\X: 12 DBG> EVALUATE X ! Evaluate and display the value of X 12 DBG> EVALUATE X + 4 ! Add the value of X to 4 16 DBG> DEPOSIT X = X/2 ! Divide the value of X by 2 and assign ! the resulting value to X DBG> EXAMINE X ! Display the new value of X MOD4\X: 6 DBG>
Using a variable in a language expression as shown in the previous examples is generally limited to single-valued, noncomposite variables. Typically, you can specify a multivalued, composite variable (like an array or record) in a language expression only if the syntax indicates that you are referencing only a single value (a single element of the aggregate). For example, if ARR is the name of an array of integers, the following command is invalid:
DBG> EVALUATE ARR %DEBUG-W-NOVALUE, reference does not have a value DBG>
However, the following commands are valid because only a single element of the array is referenced:
DBG> EVALUATE ARR(2) ! Evaluate element 2 of array ARR 37 DBG> DEPOSIT K = 5 + ARR(2) ! Deposit the sum of two integer DBG> ! values into an integer variable
If the current language is BLISS, the debugger interprets a variable in a language expression as the address of that variable. To denote the value stored in a variable, you must use the contents-of operator (period (.)). For example, when the language is set to BLISS:
DBG> EXAMINE Y ! Display the value of Y. MOD4\Y: 3 DBG> EVALUATE Y ! Display the address of Y. 02475B DBG> EVALUATE .Y ! Display the value of Y. 3 DBG> EVALUATE Y + 4 ! Add 4 to the address of Y and 02475F ! display the resulting value. DBG> EVALUATE .Y + 4 ! Add 4 to the value of Y and display 7 ! the resulting value. DBG>
For all languages, to obtain the address of a variable, use the
EVALUATE/ADDRESS command as described in Section 4.1.11. The EVALUATE
and EVALUATE/ADDRESS commands both display the address of an address
expression when the language is set to BLISS.
When evaluating language expressions involving numeric types of different precision, the debugger first converts lower-precision types to higher-precision types before performing the evaluation. In the following example, the debugger converts the integer 1 to the real 1.0 before doing the addition:
DBG> EVALUATE 1.5 + 1 2.5 DBG>
The basic rules are as follows:
In general, the debugger allows more numeric type conversion than the programming language. In addition, the hardware type used for a debugger calculation (word, longword, G_float, and so on) might differ from that chosen by the compiler. Because the debugger is not as strongly typed or as precise as some languages, the evaluation of an expression by the EVALUATE command might differ from the result that would be calculated by compiler-generated code and obtained with the EXAMINE command.
Do not confuse address expressions with language expressions. An address expression specifies a program location; a language expression specifies a value. In particular, the EXAMINE command expects an address expression as its parameter, and the EVALUATE command expects a language expression as its parameter. These points are shown in the next examples.
In the following example, the value 12 is deposited into the variable X. This is confirmed by the EXAMINE command. The EVALUATE command computes and displays the sum of the current value of X and the integer literal 6,
DBG> DEPOSIT X = 12 DBG> EXAMINE X MOD3\X: 12 DBG> EVALUATE X + 6 18 DBG>
In the next example, the EXAMINE command displays the value currently stored at the memory location that is 6 bytes beyond the address of X:
DBG> EXAMINE X + 6 MOD3\X+6: 274903 DBG>
In this case the location is not associated with a compiler-generated type. Therefore, the debugger interprets and displays the value stored at that location in the type longword integer (see Section 4.1.5).
In the next example, the value of X + 6 (that is, 18) is deposited into the location that is 6 bytes beyond the address of X. This is confirmed by the last EXAMINE command.
DBG> EXAMINE X MOD3\X: 12 DBG> DEPOSIT X + 6 = X + 6 DBG> EXAMINE X MOD3\X: 12 DBG> EXAMINE X + 6 MOD3\X+6: 18 DBG>
When using the EXAMINE and DEPOSIT commands, you can use three special built-in symbols (address expressions) to refer quickly to the current, previous, and next data locations (logical entities). These are the period (.), the circumflex (^), and the Return key.
The period (.), when used by itself with an EXAMINE or DEPOSIT command, denotes the current entity---that is, the program location most recently referenced by an EXAMINE or DEPOSIT command. For example:
DBG> EXAMINE X SIZE\X: 7 DBG> DEPOSIT . = 12 DBG> EXAMINE . SIZE\X: 12 DBG>
The circumflex (^) and Return key denote, respectively, the previous and next logical data locations relative to the last EXAMINE or DEPOSIT command (the logical predecessor and successor, respectively). The circumflex and Return key are useful for referring to consecutive indexed components of an array. The following example shows the use of these operators with an array of integers, ARR:
DBG> EXAMINE ARR(5) ! Examine element 5 of array ARR MAIN\ARR(5): 448670 DBG> EXAMINE ^ ! Examine the previous element (4) MAIN\ARR(4): 792802 DBG> EXAMINE [Return] ! Examine the next element (5) MAIN\ARR(5): 448670 DBG> EXAMINE [Return] ! Examine the next element (6) MAIN\ARR(6): 891236 DBG>
The debugger uses the type associated with the current entity to determine logical successors and predecessors.
You can also use the built-in symbols %CURLOC, %PREVLOC, and %NEXTLOC to achieve the same purpose as the period, circumflex, and Return key, respectively. These symbols are useful in command procedures and also if your program uses the circumflex for other purposes. Moreover, using the Return key to signify the logical successor does not apply to all contexts. For example, you cannot press the Return key after entering the DEPOSIT command to indicate the next location, but you can always use the symbol %NEXTLOC for that purpose.
Note that, like EXAMINE and DEPOSIT, the EVALUATE/ADDRESS command also resets the values of the current, previous, and next logical-entity built-in symbols (see Section 4.1.11). However, you cannot press the Return key after entering the EVALUATE/ADDRESS command to indicate the next location. For more information about debugger built-in symbols, see Appendix B.
The previous examples show the use of the built-in symbols after referencing a symbolic name with the EXAMINE or DEPOSIT command. If you examine or deposit into a memory address, that location might or might not be associated with a compiler-generated type. When you reference a memory address, the debugger uses the following conventions to determine logical predecessors and successors:
As the current entity is reset with new examine or deposit operations, the debugger associates each new location with a type in the manner indicated to determine logical successors and predecessors. This is shown in the following examples.
Assume that a Fortran program has declared three variables, ARY, FLT, and BTE, as follows:
Assume that storage for these variables has been allocated at consecutive addresses in memory, starting with 1000. For example:
1000: ARY(1) 1002: ARY(2) 1004: ARY(3) 1006: FLT 1010: BTE 1011: undefined . . .
Examining successive logical data locations will give the following results:
DBG> EXAMINE 1000 ! Examine ARY(1), associated with 1000. MOD3\ARY(1): 13 ! Current entity is now ARY(1). DBG> EXAMINE [Return] ! Examine next location, ARY(2), MOD3\ARY(2): 7 ! using type of ARY(1) as reference. DBG> EXAMINE [Return] ! Examine next location, ARY(3). MOD3\ARY(3): 19 ! Current entity is now ARY(3). DBG> EXAMINE [Return] ! Examine entity at 1006 (FLT). MOD3\FLT: 1.9117807E+07 ! Current entity is now FLT. DBG> EXAMINE [Return] ! Examine entity at 1010 (BTE). MOD3\BTE: 43 ! Current entity is now BTE. DBG> EXAMINE [Return] ! Examine entity at 1011 (undefined). 1011: 17694732 ! Interpret data as longword integer. DBG> ! Location is not symbolized.
The same principles apply when you use type qualifiers with the EXAMINE and DEPOSIT commands (see Section 4.5.2). The type specified by the qualifier determines the data boundary of an entity and, therefore, any logical successors and predecessors.
The debugger enables you to set your debugging context to any of several supported languages. The setting of the current language determines how the debugger parses and interprets the names, numbers, operators, and expressions you specify in debugger commands, and how it displays data.
By default, the current language is the language of the module containing the main program, and it is identified when you bring the program under debugger control. For example:
$ PASCAL/NOOPTIMIZE/DEBUG TEST1 $ LINK/DEBUG TEST1 $ DEBUG/KEEP Debugger Banner and Version Number DBG> RUN TEST1 Language: PASCAL, Module: TEST1 DBG>
When debugging modules whose code is written in other languages, you can use the SET LANGUAGE command to establish a new language-dependent context. Section 13.3 highlights some important language differences. Debugger support for operators and other constructs in language expressions is listed for each language in the debugger's online help (type HELP Language).
The debugger can interpret and display integer data in any one of four radixes: decimal, hexadecimal, octal, and binary. The default radix is decimal for most languages.
On VAX processors, the exceptions are BLISS and MACRO--32, which have a default radix of hexadecimal.
On Alpha processors, the exceptions are BLISS, MACRO--32 and MACRO--64, which have a default radix of hexadecimal.
You can control the radix for the following kinds of integer data:
You cannot control the radix for other kinds of integer data. For example, addresses are always displayed in hexadecimal radix in a SHOW CALLS display. Or, when specifying an integer n with various command qualifiers (/AFTER:n, /UP:n, and so on), you must use decimal radix.
The technique you use to control radix depends on your objective. To establish a new radix for all subsequent commands, use the SET RADIX command. For example:
DBG> SET RADIX HEXADECIMAL
After this command is executed, all integer data that you enter in address or language expressions is interpreted as being hexadecimal. Also, all integer data displayed by the EVALUATE and EXAMINE commands is given in hexadecimal radix.
The SHOW RADIX command identifies the current radix (which is either the default radix, or the radix last established by a SET RADIX command). For example:
DBG> SHOW RADIX input radix: hexadecimal output radix: hexadecimal DBG>
The SHOW RADIX command identifies both the input radix (for data entry) and the output radix (for data display). The SET RADIX command qualifiers /INPUT and /OUTPUT enable you to specify different radixes for data entry and display. For more information, see the SET RADIX command.
Use the CANCEL RADIX command to restore the default radix.
The examples that follow show several techniques for displaying or entering integer data in another radix without changing the current radix.
To convert some integer data to another radix without changing the current radix, use the EVALUATE command with a radix qualifier (/BINARY, /DECIMAL, /HEXADECIMAL, /OCTAL). For example:
DBG> SHOW RADIX input radix: decimal output radix: decimal DBG> EVALUATE 18 + 5 23 ! 23 is decimal integer. DBG> EVALUATE/HEX 18 + 5 00000017 ! 17 is hexadecimal integer. DBG>
The radix qualifiers do not affect the radix for data entry.
To display the current value of an integer variable (or the contents of a program location that has an integer type) in another radix, use the EXAMINE command with a radix qualifier. For example:
DBG> EXAMINE X MOD4\X: 4398 ! 4398 is a decimal integer. DBG> EXAMINE/OCTAL . ! X is the current entity. MOD4\X: 00000010456 ! 10456 is an octal integer. DBG>
To enter one or more integer literals in another radix without changing the current radix, use one of the radix built-in symbols %BIN, %DEC, %HEX, or %OCT. A radix built-in symbol directs the debugger to treat an integer literal that follows (or all numeric literals in a parenthesized expression that follows) as a binary, decimal, hexadecimal, or octal number, respectively. These symbols do not affect the radix for data display. For example:
DBG> SHOW RADIX input radix: decimal output radix: decimal DBG> EVAL %BIN 10 ! Evaluate the binary integer 10. 2 ! 2 is a decimal integer. DBG> EVAL %HEX (10 + 10) ! Evaluate the hexadecimal integer 20. 32 ! 32 is a decimal integer. DBG> EVAL %HEX 20 + 33 ! Treat 20 as hexadecimal, 33 as decimal. 65 ! 65 is a decimal integer. DBG> EVAL/HEX %OCT 4672 ! Treat 4672 as octal and display in hex. 000009BA ! 9BA is a hexadecimal number. DBG> EXAMINE X + %DEC 12 ! Examine the location 12 decimal bytes MOD3\X+12: 493847 ! beyond the address of X. DBG> DEPOS J = %OCT 7777777 ! Deposit an octal value. DBG> EXAMINE . ! Display that value in decimal radix. MOD3\J: 2097151 DBG> EXAMINE/OCTAL . ! Display that value in octal radix. MOD3\J: 00007777777 DBG> EXAMINE %HEX 0A34D ! Examine location A34D, hexadecimal. SHARE$LIBRTL+4941: 344938193 ! 344938193 is a decimal integer. DBG>
Note
When specifying a hexadecimal integer that starts with a letter rather than a number (for example, A34D in the last example), add a leading 0. Otherwise, the debugger tries to interpret the integer as a symbol declared in your program.
For more examples showing the use of the radix built-in symbols, see Appendix B.
Use the EVALUATE/ADDRESS command to determine the memory address or the register name associated with a symbolic address expression, such as a variable name, line number, routine name, or label. For example:
DBG> EVALUATE/ADDRESS X ! A variable name 2476 DBG> EVALUATE/ADDRESS SWAP ! A routine name 1536 DBG> EVALUATE/ADDRESS %LINE 26 1629 DBG>
4538P006.HTM OSSG Documentation 22-NOV-1996 13:01:38.27
Copyright © Digital Equipment Corporation 1996. All Rights Reserved.