Condition entries
COBOL has the notion of a level-88 condition that
associates a data item, called the conditional variable, with a set
of one or more constant values or value ranges. Semantically, the
condition is true if the value of the conditional
variable matches any of the described constants, and the condition
is false otherwise.
The DW_TAG_condition debugging
information entry describes a logical condition that tests whether
a given data item's value matches one of a set of constant values.
If a name has been given to the condition, the condition entry has
a DW_AT_name attribute whose value is a null-terminated
string giving the condition name as it appears in the source program.
The
parent entry of the condition entry describes the conditional variable.
Normally this will be a DW_TAG_variable, DW_TAG_member,
or DW_TAG_formal_parameter entry. If the parent entry
has an array type, the condition can test any individual element,
but not the array as a whole. The condition entry implicitly specifies
a comparison type that is the type of an array element
if the parent has an array type; otherwise it is the type of the parent
entry.
The condition entry owns DW_TAG_constant and DW_TAG_subrange_type entries
that describe the constant values associated with the condition. If
any child entry has a DW_AT_type attribute, that
attribute should describe a type compatible with the comparison type
(according to the source language); otherwise the type of the child
is the same as the comparison type.
For conditional variables with alphanumeric types, COBOL permits a source program to provide ranges of alphanumeric constants in the condition. Normally a subrange type entry does not describe ranges of strings. However, this can be represented using bounds attributes that are references to constant entries describing strings. A subrange type entry may refer to constant entries that are siblings of the subrange type entry.
1 ALPHA PIC X(10).
88 TESTALPHA VALUE 'TOM', 'FRED', 'A' thru 'Z'.$01: DW_TAG_string_type
DW_AT_picture_string (X(1))
DW_AT_byte_size (1)
$02: DW_TAG_string_type
DW_AT_picture_string (X(3))
DW_AT_byte_size (3)
$03: DW_TAG_string_type
DW_AT_picture_string (X(4))
DW_AT_byte_size (4)
$10: DW_TAG_variable
DW_AT_name (ALPHA)
$11: DW_TAG_condition
DW_AT_name (TESTALPHA)
$12: DW_TAG_constant
DW_AT_const_value (c1) ! 'A'
DW_AT_type ($01)
$13: DW_TAG_constant
DW_AT_const_value (e9) ! 'Z'
DW_AT_type ($01)
$14: DW_TAG_subrange_type
DW_AT_lower_bound ($12)
DW_AT_upper_bound ($13)
$15: DW_TAG_constant
DW_AT_const_value (c6d9c5c4) ! 'FRED'
DW_AT_type ($03)
$16: DW_TAG_constant
DW_AT_const_value (e3d6d4) ! 'TOM'
DW_AT_type ($02)