Issue 220824.1: Use uniform encoding of DWARF expressions in CFI instructions
Author: | Serhii Huralnik |
---|---|
Champion: | Brock Wyma |
Date submitted: | 2022-08-24 |
Date revised: | 2023-01-13 |
Date closed: | 2023-06-12 |
Type: | Ambiguity |
Status: | Accepted with editorial changes |
DWARF Version: | 6 |
Section 6.4.2, pg various
Three CFI instructions use DWARF expressions as operands - DW_CFA_def_cfa_expression
,
DW_CFA_expression
, DW_CFA_val_expression
.
DW_CFA_def_cfa_expression
paragraph says that the "operand (is) encoded as a
DW_FORM_exprloc
value representing a DWARF expression". Note that this wording
also eliminates a possibility for this 'exprloc' to encode a location description.
DW_CFA(_val)_expression
paragraphs say that the operand is "a DW_FORM_block
value
representing a DWARF expression".
Given that all three can use only DWARF expressions (not location descriptions) -
should DW_CFA_def_cfa_expression
be changed so there would be a unified wording
for all three to use DW_FORM_block
? Moreover, page 239 says that
DW_CFA_def_cfa_expression
uses BLOCK (not EXPRLOC), which contradicts the
instruction definition at the page 178.
Change seems to be backward-compatible as at the representation level both 'block' and 'exprloc' are identical - ULEB128 length field followed by information bytes.
PROPOSED CHANGES
6.4.2.2 CFA Definition Instructions
6. DW_CFA_def_cfa_expression
Replace "a DW_FORM_exprloc
" with "an exprloc". New text:
The
DW_CFA_def_cfa_expression
instruction takes a single operand encoded as an exprloc value representing a DWARF expression.
6.4.2.3 Register Rule Instructions
9. DW_CFA_expression
Replace "a DW_FORM_block" with "an exprloc". New text:
The
DW_CFA_expression
instruction takes two operands: an unsigned LEB128 value representing a register number, and an exprloc value representing a DWARF expression.
10. DW_CFA_val_expression
Replace "a DW_FORM_block
" with "an exprloc". New text:
The
DW_CFA_val_expression
instruction takes two operands: an unsigned LEB128 value representing a register number, and an exprloc value representing a DWARF expression.
7.24 Call Frame Information
Table 7.29: Call frame instruction encodings
Change "BLOCK" to "exprloc" and add "register" to DW_CFA_val_expression.
New table entries:
| DW_CFA_def_cfa_expression | 0 | 0x0f | exprloc | |
| DW_CFA_expression | 0 | 0x10 | ULEB128 register | exprloc |
| DW_CFA_val_expression | 0 | 0x16 | ULEB128 register | exprloc |
2023-01-13: Add proposed changes.
2023-06-12: Fixed section reference.
2023-06-12: Accepted, with additional editorial changes:
Update Table 7.29, DW_CFA_val_offset
and DW_CFA_val_offset_sf
:
Add "register" in Operand 1 column and "offset" in Operand 2 column.