DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



220824.1 Serhii Huralnik Use uniform encoding of DWARF expressions in CFI instructions Ambiguity Open Brock Wyma


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 tat 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.3 Register Rule 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.


  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.


All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2022 by DWARF Standards Committee.