||FORM Reform Proposal 2: Block Class Forms and Expressions
||Accepted with changes
Since expressions can contain reference to DIEs, it's important for any
generic DWARF consumer to be able to identify and parse expressions without
a complete understanding of what attributes may have blocks that should be
treated as expressions. This proposal adds a new form, DW_FORM_expr, which
takes a ULEB128 length parameter, followed by "length" bytes interpreted as
I don't believe that fixed 1-, 2-, 4-, and 8-byte lengths are necessary
here -- any producer should be able to determine how long the expression
is before it needs to emit the length field.
This proposal also deprecates DW_FORM_block1, block2, and block4 in favor
of DW_FORM_block. For blocks that aren't expressions (e.g., constant values
expressed as a block of bytes), the length of the block can just as easily
be expressed as a ULEB128. Any producer can reasonably be expected to know
how long the block is before it needs to emit the length.
The proposed changes to the DWARF specification are detailed below, keyed
to the section numbering for the December 20, 2005, version of the DWARF-3
In Section 2.2, "Attribute Types," add the following row to the table of
expr An arbitrary number of bytes of data, interpreted
as a DWARF expression (see Section 2.5).
[Note: The terminology for DWARF expressions has been under discussion.
This proposal may need to be updated to be consistent with the final
In Section 22.214.171.124, "CFA Definition Instructions," Item 6,
"DW_CFA_def_cfa_expression", change "DW_FORM_block" to "DW_FORM_expr".
In Section 7.5.4, "Attribute Encodings," add the following paragraph to
the description of class block:
The use of forms DW_FORM_block1, DW_FORM_block2,
and DW_FORM_block4 is deprecated. Producers should
use DW_FORM_block instead.
Add the following paragraphs immediately preceding the description for
Represented as an unsigned LEB128 length followed by the
number of bytes specified by the length (DW_FORM_expr).
The information bytes contain a DWARF expression (see
In FIgure 20, "Attribute encodings," change "block" to "expr" in the
"Classes" column for the following attributes:
In Figure 21, add the following row:
Form name Value Class
DW_FORM_expr 0x18 expr
Accepted with changes:
1. Remove DW_AT_namelist_item from list of changes
2. Fix typo on pg. 136 -- DW_AT_namelist_item is reference, not block
3. No deprecation of block1-4
4. Clarify block form description (pg. 126) with reference to expr.