Debugging with GDB

Node:Values and their Operations, Next:Chill type and range checks, Previous:Locations, Up:Chill

##### Values and their Operations

Values are used to alter locations, to investigate complex structures in more detail or to filter relevant information out of a large amount of data. There are several (mode dependent) operations defined which enable such investigations. These operations are not only applicable to constant values but also to locations, which can become quite useful when debugging complex structures. During parsing the command line (e.g. evaluating an expression) GDB treats location names as the values behind these locations.

This section describes how values have to be specified and which operations are legal to be used with such values.

`Literal Values`
  Literal values are specified in the same manner as in GNU Chill programs. For detailed specification refer to the GNU Chill implementation Manual chapter 1.5.
`Tuple Values`
  A tuple is specified by `<mode name>[<tuple>]`, where `<mode name>` can be omitted if the mode of the tuple is unambiguous. This unambiguity is derived from the context of a evaluated expression. `<tuple>` can be one of the following:
  - Powerset Tuple
  - Array Tuple
  - Structure Tuple Powerset tuples, array tuples and structure tuples are specified in the same manner as in Chill programs refer to z200/88 chpt 5.2.5.
`String Element Value`
  A string element value is specified by

                <string value>(<index>)

  where `<index>` is a integer expression. It delivers a character value which is equivalent to the character indexed by `<index>` in the string.
`String Slice Value`
  A string slice value is specified by `<string value>(<slice spec>)`, where `<slice spec>` can be either a range of integer expressions or specified by `<start expr> up <size>`. `<size>` denotes the number of elements which the slice contains. The delivered value is a string value, which is part of the specified string.
`Array Element Values`
  An array element value is specified by `<array value>(<expr>)` and delivers a array element value of the mode of the specified array.
`Array Slice Values`
  An array slice is specified by `<array value>(<slice spec>)`, where `<slice spec>` can be either a range specified by expressions or by `<start expr> up <size>`. `<size>` denotes the number of arrayelements the slice contains. The delivered value is an array value which is part of the specified array.
`Structure Field Values`
  A structure field value is derived by `<structure value>.<field name>`, where `<field name>` indicates the name of a field specified in the mode definition of the structure. The mode of the delivered value corresponds to this mode definition in the structure definition.
`Procedure Call Value`
  The procedure call value is derived from the return value of the procedure1.

  Values of duration mode locations are represented by `ULONG` literals.

  Values of time mode locations appear as

                TIME(<secs>:<nsecs>)

`Zero-adic Operator Value`
  The zero-adic operator value is derived from the instance value for the current active process.
`Expression Values`
  The value delivered by an expression is the result of the evaluation of the specified expression. If there are error conditions (mode incompatibility, etc.) the evaluation of expressions is aborted with a corresponding error message. Expressions may be parenthesised which causes the evaluation of this expression before any other expression which uses the result of the parenthesised expression. The following operators are supported by GDB:
  `OR, ORIF, XOR`
  `AND, ANDIF`
  `NOT`
    Logical operators defined over operands of boolean mode.
  `=, /=`
    Equality and inequality operators defined over all modes.
  `>, >=`
  `<, <=`
    Relational operators defined over predefined modes.
  `+, -`
  `*, /, MOD, REM`
    Arithmetic operators defined over predefined modes.
  `-`
    Change sign operator.
  `//`
    String concatenation operator.
  `()`
    String repetition operator.
  `->`
    Referenced location operator which can be used either to take the address of a location (`->loc`), or to dereference a reference location (`loc->`).
  `OR, XOR`
  `AND`
  `NOT`
    Powerset and bitstring operators.
  `>, >=`
  `<, <=`
    Powerset inclusion operators.
  `IN`
    Membership operator.

#### Footnotes

1. If a procedure call is used for instance in an expression, then this procedure is called with all its side effects. This can lead to confusing results if used carelessly.