Document revision date: 30 March 2001

## OpenVMS Debugger Manual

Previous | Contents | Index

### C.10.5 Initialization Code

When you debug a program that compiled with the /CHECK=UNDERFLOW or /PARALLEL qualifier, a message appears, as in the following example:

    DBG> RUN FORMS
    Language: FORTRAN, Module: FORMS
    Type GO to reach main program
    DBG>

The "Type GO to reach MAIN program" message indicates that execution is supended before the start of the main program, so that you can execute initialization code under debugger control. Entering the GO command places you at the start of the main program. At that point, enter the GO command again to start program execution, as with other types of Fortran programs.

## C.11 MACRO-32

The following subtopics describe debugger support for MACRO-32.

### C.11.1 Operators in Language Expressions

The MACRO-32 language does not have expressions in the same sense as high-level languages. Only assembly-time expressions and only a limited set of operators are accepted. To permit the MACRO-32 programmer to use expressions at debug-time as freely as in other languages, the debugger accepts a number of operators in MACRO-32 language expressions that are not found in MACRO-32 itself. In particular, the debugger accepts a complete set of comparison and Boolean operators modeled after BLISS. It also accepts the indirection operator and the normal arithmetic operators.

Kind | Symbol | Function
--- | --- | ---
Prefix | @ | Indirection
Prefix | . | Indirection
Prefix | + | Unary plus
Prefix | - | Unary minus (negation)
Infix | + | Addition
Infix | - | Subtraction
Infix | * | Multiplication
Infix | / | Division
Infix | MOD | Remainder
Infix | @ | Left shift
Infix | EQL | Equal to
Infix | EQLU | Equal to
Infix | NEQ | Not equal to
Infix | NEQU | Not equal to
Infix | GTR | Greater than
Infix | GTRU | Greater than unsigned
Infix | GEQ | Greater than or equal to
Infix | GEQU | Greater than or equal to unsigned
Infix | LSS | Less than
Infix | LSSU | Less than unsigned
Infix | LEQ | Less than or equal to
Infix | LEQU | Less than or equal to unsigned
Prefix | NOT | Bit-wise NOT
Infix | AND | Bit-wise AND
Infix | OR | Bit-wise OR
Infix | XOR | Bit-wise exclusive OR
Infix | EQV | Bit-wise equivalence

### C.11.2 Constructs in Language and Address Expressions

Supported constructs in language and address expressions for MACRO-32 follow:

Symbol | Construct
--- | ---
[ ] | Subscripting
<p,s,e> | Bit field selection as in BLISS

The DST information generated by the MACRO-32 assembler treats a label that is followed by an assembler directive for storage allocation as an array variable whose name is the label. This enables you to use the array syntax of a high-level language when examining or manipulating such data.

In the following example of MACRO-32 source code, the label LAB4 designates hexadecimal data stored in four words:

    LAB4:    .WORD    ^X3F,5[2],^X3C

The debugger treats LAB4 as an array variable. For example, the following command displays the value stored in each element (word):

    DBG> EXAMINE LAB4
    .MAIN.\MAIN\LAB4
        [0]:        003F
        [1]:        0005
        [2]:        0005
        [3]:        003C

The following command displays the value stored in the fourth word (the first word is indexed as element "0"):

    DBG> EXAMINE LAB4[3]
    .MAIN.\MAIN\LAB4[3]:    03C

### C.11.3 Data Types

MACRO-32 binds a data type to a label name according to the assembler directive that follows the label definition. Supported MACRO-32 directives follow:

MACRO-32 Directives | Operating System Data Type Name
--- | ---
.BYTE | Byte Unsigned (BU)
.WORD | Word Unsigned (WU)
.LONG | Longword Unsigned (LU)
.SIGNED_BYTE | Byte Integer (B)
.SIGNED_WORD | Word Integer (W)
.LONG | Longword Integer (L)
.QUAD | Quadword Integer (Q)
.F_FLOATING | F_Floating (F)
.D_FLOATING | D_Floating (D)
.G_FLOATING | G_Floating (G)
.H_FLOATING | H_Floating (H) (VAX specific)
(Not applicable) | Packed decimal (P)

### C.11.4 MACRO-32 Compiler (AMACRO) (Alpha Only)

Programmers who are porting applications written in MACRO-32 to Alpha systems use the MACRO-32 compiler (AMACRO). A debugging session for compiled MACRO-32 code is similar to that for assembled code. However, there are some important differences that are described in this section. For complete information on porting these applications, see the Porting VAX MACRO Code from OpenVMS VAX to OpenVMS Alpha manual.

#### C.11.4.1 Code Relocation

One major difference is the fact that the code is compiled. On a VAX system, each MACRO-32 instruction is a single machine instruction. On an Alpha system, each MACRO-32 instruction may be compiled into many Alpha machine instructions. A major side effect of this difference is the relocation and rescheduling of code if you do not specify /NOOPTIMIZE in your compile command. After you have debugged your code, you can recompile without /NOOPTIMIZE to improve performance.

#### C.11.4.2 Symbolic Variables

Another major difference between debugging compiled code and debugging assembled code is a new concept to MACRO--2, the definition of symbolic variables for examining routine arguments. On VAX systems, when you were debugging a routine and wanted to examine the arguments, you would typically do something like the following:

            DBG> EXAMINE @AP        ; to see the argument count
            DBG> EXAMINE @AP+4      ; to examine the first arg

or

            DBG> EXAMINE @AP        ; to see arg count
            DBG> EXAMINE .+4:.+20   ; to see first 5 args

On Alpha systems, the arguments do not reside in a vector in memory as they did on VAX systems. Furthermore, there is no AP register on Alpha systems. If you type EXAMINE @AP when debugging MACRO compiled code, the debugger reports that AP is an undefined symbol.

In the compiled code, the arguments can reside in some combination of:

- Registers
- On the stack above the routine's stack frame
- In the stack frame, if the argument list was "homed" (that is, placed in the fixed position of the stack frame to resolve VAX AP references) or if there are calls out of the routine that would require the register arguments to be saved

The compiler does not require that you read the generated code to locate the arguments. Instead, it provides $ARGn symbols that point to the correct argument locations. $ARG0 is the same as @AP+0 is on VAX systems, that is, the argument count. $ARG1 is the first argument, $ARG2 is the second argument, and so forth. These symbols are defined in CALL_ENTRY and JSB_ENTRY directives, but not in EXCEPTION_ENTRY directives.

#### C.11.4.3 Locating Arguments Without $ARGn Symbols

There may be additional arguments in your code for which the compiler did not generate a $ARGn symbol. The number of $ARGn symbols defined for a .CALL_ENTRY routine is the maximum number detected by the compiler (either by automatic detection or as specified by MAX_ARGS) or 16, whichever is less. For a .JSB_ENTRY routine, since the arguments are homed in the caller's stack frame and the compiler cannot detect the actual number, it always creates eight $ARGn symbols.

In most cases, you can easily find any additional arguments, but in some cases you cannot.

#### C.11.4.4 Arguments That Are Easy to Locate

You can easily find additional arguments if:

- The argument list is not homed, and $ARGn symbols are defined to $ARG7 or higher. If the argument list is not homed, the $ARGn symbols $ARG7 and above always point into the list of parameters passed as quadwords on the stack. Subsequent arguments will be in quadwords following the last defined $ARGn symbol.
- The argument list has been homed, and you want to examine an argument that is less than or equal to the maximum number detected by the compiler (either by automatic detection or as specified by MAX_ARGS). If the argument list is homed, $ARGn symbols always point into the homed argument list. Subsequent arguments will be in longwords following the last defined $ARGn symbol.

For example, you can examine arguments beyond the eighth argument in a JSB routine (where the argument list must be homed in the caller), as follows:

      DBG> EX $ARG8  ; highest defined $ARGn
      .
      .
      .
      DBG> EX .+4  ; next arg is in next longword
      .
      .
      .
      DBG> EX .+4  ; and so on

This example assumes that the caller detected at least ten arguments when homing the argument list.

To find arguments beyond the last $ARGn symbol in a routine that did not home the arguments, proceed exactly as in the previous example except substitute EX .+8 for EX .+4.

#### C.11.4.5 Arguments That Are Not Easy to Locate

You cannot easily find additional arguments if:

- The argument list is homed, and you want to examine arguments beyond the number detected by the compiler. The $ARGn symbols point to the longwords that are stored in the homed argument list. The compiler only moves as many arguments as it can detect into this list. Examining longwords beyond the last argument that was homed will result in examining various other stack context.
- The argument list is not homed, and $ARGn symbols are defined only as high as $ARG6. In this case, the existing $ARGn symbols will either point to registers or to quadword locations in the stack frame. In both cases, subsequent arguments cannot be examined by looking at quadword locations beyond the defined $ARGn symbols.

The only way to find the additional arguments in these cases is to examine the compiled machine code to determine where the arguments reside. Both of these problems are eliminated if MAX_ARGS is specified correctly for the maximum argument that you want to examine.

#### C.11.4.6 Debugging Code with Floating-Point Data

The following list provides important information about debugging compiled MACRO-32 code with floating-point data on an Alpha system:

- You can use the EXAMINE/FLOAT command to examine an Alpha integer register for a floating-point value.
  Even though there is a set of registers for floating-point operations on Alpha systems, those registers are not used by compiled MACRO-32 code that contains floating-point operations. Only the Alpha integer registers are used.
  Floating-point operations in compiled MACRO-32 code are performed by emulation routines that operate outside the compiler. Therefore, performing MACRO-32 floating-point operations on, say, R7, has no effect on Alpha floating-point register 7.
- When using the EXAMINE command to examine a location that was declared with a .FLOAT directive or other floating-point storage directives, the debugger automatically displays the value as floating-point data.
- When using the EXAMINE command to examine the G_FLOAT data type, the debugger does not use the contents of two registers to build the value for VAX data.
  Consider the following example:

      EXAMINE/G_FLOAT   R4

  In this example, the lower longwords of R4 and R5 are not used to build the value as is the case on VAX. Instead, the quadword contents of R4 are used.
  The code the compiler generates for D_FLOAT and G_FLOAT operations preserves the VAX format of the data in the low longwords of two consecutive registers. Therefore, using EXAMINE/G_FLOAT on either of these two registers will not give the true floating-point value, and issuing DEPOSIT/G_FLOAT to one of these registers will not give the desired results. You can manually combine the two halves of such a value, however. For example, assume you executed the following instruction:

      MOVG    DATA, R6

  You could then read the G_FLOAT value which now resides in R6 and R7 with a sequence like the following:

      DBG> EX R6
      .MAIN.\%LINE 100\%R6:   0FFFFFFFF D8E640D1
      DBG> EX R7
      .MAIN.\%LINE 100\%R7:   00000000 2F1B24DD
      DBG> DEP R0 = 2F1B24DDD8E640D1
      DBG> EX/G_FLOAT R0
      .MAIN.\%LINE 100\%R0:   4568.89900000000

- You can deposit floating-point data in an Alpha integer register with the DEPOSIT command. The syntax is the same as it is on VAX.
- H_FLOAT is unsupported.

#### C.11.4.7 Debugging Code with Packed Decimal Data

The following list provides important information about debugging compiled MACRO-32 code with packed decimal data on an Alpha system:

- When using the EXAMINE command to examine a location that was declared with a .PACKED directive, the debugger automatically displays the value as a packed decimal data type.
- You can deposit packed decimal data. The syntax is the same as it is on VAX.

## C.12 MACRO-64 (Alpha Only)

The following subtopics describe debugger support for MACRO-64.

### C.12.1 Operators in Language Expressions

Language MACRO-64 does not have expressions in the same sense as high-level languages. Only assembly-time expressions and only a limited set of operators are accepted. To permit the MACRO-64 programmer to use expressions at debug-time as freely as in other languages, the debugger accepts a number of operators in MACRO-64 language expressions that are not found in MACRO-64 itself. In particular, the debugger accepts a complete set of comparison and Boolean operators modeled after BLISS. It also accepts the indirection operator and the normal arithmetic operators.

Kind | Symbol | Function
--- | --- | ---
Prefix | @ | Indirection
Prefix | . | Indirection
Prefix | + | Unary plus
Prefix | - | Unary minus (negation)
Infix | + | Addition
Infix | - | Subtraction
Infix | * | Multiplication
Infix | / | Division
Infix | MOD | Remainder
Infix | @ | Left shift
Infix | EQL | Equal to
Infix | EQLU | Equal to
Infix | NEQ | Not equal to
Infix | NEQU | Not equal to
Infix | GTR | Greater than
Infix | GTRU | Greater than unsigned
Infix | GEQ | Greater than or equal to
Infix | GEQU | Greater than or equal to unsigned
Infix | LSS | Less than
Infix | LSSU | Less than unsigned
Infix | LEQ | Less than or equal to
Infix | LEQU | Less than or equal to unsigned
Prefix | NOT | Bit-wise NOT
Infix | AND | Bit-wise AND
Infix | OR | Bit-wise OR
Infix | XOR | Bit-wise exclusive OR
Infix | EQV | Bit-wise equivalence

### C.12.2 Constructs in Language and Address Expressions

Supported constructs in language and address expressions for MACRO-64 follow:

Symbol | Construct
--- | ---
<p,s,e> | Bit field selection as in BLISS

### C.12.3 Data Types

MACRO-64 binds a data type to a label name according to the data directive that follows the label definition. For example, in the following code fragment, the .LONG data directive directs MACRO-64 to bind the longword integer data type to labels V1, V2, and V3:

    .PSECT A, NOEXE
    .BYTE 5
    V1:
    V2:
    V3: .LONG 7

To confirm the type bound to V1, V2, and V3, issue a SHOW SYMBOL/TYPE command with a V* parameter. The following display results:

       data  .MAIN.\V1
          atomic type, longword integer, size: 4 bytes
       data .MAIN.\V2
          atomic type, longword integer, size: 4 bytes
       data .MAIN.\V3
          atomic type, longword integer, size: 4 bytes)

Supported MACRO-64 directives follow:

MACRO-64 Directives | Operating System Data Type Name
--- | ---
.BYTE | Byte Unsigned (BU)
.WORD | Word Unsigned (WU)
.LONG | Longword Unsigned (LU)
.SIGNED_BYTE | Byte Integer (B)
.SIGNED_WORD | Word Integer (W)
.LONG | Longword Integer (L)
.QUAD | Quadword Integer (Q)
.F_FLOATING | F_Floating (F)
.D_FLOATING | D_Floating (D)
.G_FLOATING | G_Floating (G)
.S_FLOATING (Alpha specific) | S_Floating (S)
.T_FLOATING (Alpha specific) | T_Floating (T)
(Not applicable) | Packed decimal (P)

Previous | Next | Contents | Index

| privacy and legal statement |
4538PRO_071.HTML