DBG$HELP.HLB  —  DEBUG  Address Expressions
    Several debugger commands require that you specify an address
    expression. An address expression is an entity that denotes a
    memory address or a register. Commands for which you specify
    address expressions are:

       (SET,ACTIVATE,DEACTIVATE,CANCEL) BREAK
       (SET,ACTIVATE,DEACTIVATE,CANCEL) TRACE
       (SET,ACTIVATE,DEACTIVATE,CANCEL) WATCH
       EVALUATE/ADDRESS
       EXAMINE
       DEPOSIT (at the left of the equal sign)

    In general, you can specify address expressions using the syntax
    of the currently set language. For example:

    DBG> EXAMINE A(1)     ! FORTRAN
    DBG> SET WATCH A[1]   ! Pascal
    DBG> EXAMINE C OF R   ! COBOL

    In addition, you can specify address expressions numerically, and
    you can also use the built-in symbols %LINE and %LABEL to refer
    to code locations:

    DBG> EXAMINE 512
    DBG> SET BREAK %LINE 10

    You can also use the following operators to specify addresses
    that you might not be able to access by name (nonsymbolic
    addresses):

    + - *    Arithmetic operators
    /
    @ or .   Indirection
    <p,s>    Select bit field

    For example, examine the instruction 3 bytes after line 10:

    DBG> EXAMINE %LINE 10 + 3

    Examine the location pointed to by P:

    DBG> EXAMINE @P

    Do not confuse an address expression with a language expression,
    which denotes a value rather than a program location. The
    following examples show how the same command parameter is treated
    either as an address expression or as a language expression
    depending on the command:

    Show the address of the variable X (address expression):
    DBG> EVALUATE/ADDR X
    512
    Show the current value of X (address expression):
    DBG> EXAMINE X
    X: 0
    Evaluate X (language expression):
    DBG> EVALUATE X
    0
    Evaluate X+1 (language expression):
    DBG> EVALUATE X+1
    1
    Show value at location X plus 1 byte (address expression):
    DBG>  EXAMINE X+1
    513: 0

1  –  Using Symbols and Operators in Address Expressions

    The symbols and operators that can be used in address expressions
    are listed below. A unary operator has one operand. A binary
    operator has two operands.

    Symbol           Description

    %LABEL           Specifies that the numeric literal that follows
                     is a program label (for languages like FORTRAN
                     that have numeric program labels). You can
                     qualify the label with a path name prefix that
                     specifies the containing module.
    %LINE            Specifies that the numeric literal that follows
                     is a line number in your program. You can
                     qualify the line number with a path name prefix
                     that specifies the containing module.
    Backslash (\)    When used within a path name, delimits each
                     element of the path name. In this context, the
                     backslash cannot be the leftmost element of the
                     complete path name.

                     When used as the prefix to a symbol, specifies
                     that the symbol is to be interpreted as a global
                     symbol. In this context, the backslash must be
                     the leftmost element of the symbol's complete
                     path name.
    At sign (@)      Unary operators. In an address expression, the
    Period (.)       at sign (@)  and period (.)  each function as
                     a "contents-of" operator. The "contents-of"
                     operator causes its operand to be interpreted as
                     a memory address and thus requests the contents
                     of (or value residing at) that address.
    Bit field        Unary operator. You can apply bit field
    <p,s,e>          selection to an address-expression. To select
                     a bit field, you supply a bit offset (p),  a
                     bit length (s),  and a sign extension bit (e),
                     which is optional.
    Plus sign (+)    Unary or binary operator. As a unary operator,
                     indicates the unchanged value of its operand.
                     As a binary operator, adds the preceding operand
                     and succeeding operand together.
    Minus sign (-)   Unary or binary operator. As a unary operator,
                     indicates the negation of the value of its
                     operand. As a binary operator, subtracts the
                     succeeding operand from the preceding operand.
    Multiplication   Binary operator. Multiplies the preceding
    sign (*)         operand by the succeeding operand.
    Division sign    Binary operator. Divides the preceding operand
    (/)              by the succeeding operand.

    The following examples illustrate the use of built-in symbols and
    operators in address expressions.

1.1  –  %LINE and %LABEL Operators

    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

1.2  –  Path Name Operators

    The following command displays the value of the variable COUNT
    that is declared in routine ROUT2 of module MOD4. The backslash
    (\)  path name delimiter separates the path name 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

1.3  –  Arithmetic Operators

    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):

    1. The use of delimiters (usually parentheses or brackets) to
       group operands with particular operators

    2. The assignment of relative priority to each operator

    3. Left-to-right priority of operators

    The debugger operators are listed in decreasing order of
    precedence as follows:

    1. Unary operators ((.),  (@), (+),  (-))

    2. Multiplication and division operators ((*),  (/))

    3. Addition and subtraction operators ((+),  (-))

    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

1.4  –  Contents-of Operator

    The following examples illustrate use of the contents-of
    operator. In the next 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, assume that the value of pointer variable
    PTR is 7FF00000 hexadecimal, the address of an entity that you
    want to examine. Assume further that the value of this entity is
    3FF00000 hexadecimal. The following command shows how to examine
    the entity:

    DBG> EXAMINE/LONG .PTR
    7FF00000: 3FF00000
    DBG>

1.5  –  Bit-Field Operator

    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, you would
    enter the following command:

    DBG> EXAMINE X_NAME <3,4,0>
Close Help