Issue 230103.1: Clarify that DW_CFA_remember_state includes the current CFA

Author: Fangrui Song
Champion: Fangrui Song
Date submitted: 2023-01-03
Date revised: 2023-07-24
Date closed: 2023-07-04
Type: Clarification
Status: Accepted
DWARF Version: 6

Section 6.4.2.4, pg 181

p181 6.4.2.4 Row State Instructions describes the required actions for DW_CFA_remember_state and DW_CFA_restore_state:

DW_CFA_remember_state
The DW_CFA_remember_state instruction takes no operands. The required action is to push the set of rules for every register onto an implicit stack.

DW_CFA_restore_state
The DW_CFA_restore_state instruction takes no operands. The required action is to pop the set of rules off the implicit stack and place them in the current row.

The description of DW_CFA_remember_state should take the current CFA into account. Suggested change:

DW_CFA_remember_state The DW_CFA_remember_state instruction takes no operands. The required action is to push the set of rules for the current CFA and every register onto an implicit stack.

The description of DW_CFA_restore_state can remain as is as "the set of rules" clearly includes the current CFA described by DW_CFA_remember_state.

The stack implementations of libunwind src/dwarf/Gparser.c, gcc libgcc/unwind-dw2.c, and llvm-project libunwind/src/DwarfParser.hpp all include the current CFA in the implicit stack.


2023-07-24: Accepted.