[Dwarf-Discuss] DW_CFA_def_cfa_expression vs DW_CFA_def_cfa_register

Roland McGrath roland at redhat.com
Thu Apr 22 21:07:01 PDT 2010

If an FDE contains:

	DW_def_cfa_expression BLOCK
	DW_def_cfa_register REGNO

then what is the offset value in force after DW_def_cfa_register?
(The same question applies to the register number in force for
a DW_CFA_def_cfa_offset{,_sf} after DW_def_cfa_expression.)

It seems to be implied that "current CFA state" is not either an expression
block OR a (REGNO, OFFSET) pair, but rather is a (REGNO, OFFSET) pair AND
an optional expression block that supercedes it.  DW_CFA_def_cfa* ops other
than DW_CFA_def_cfa_expression remove the expression block from the current
state, so the hidden REGNO and/or OFFSET (if not just replaced) again prevail.

Is that how it's intended to be read?  If so, it seems sufficiently
nonobvious to merit some mention in the text for DW_CFA_def_cfa_expression.
If not, and the case above is intended to reset OFFSET to zero or something
like that, then the standard as written really doesn't say that at all and
is incorrect.


More information about the Dwarf-Discuss mailing list