[Dwarf-Discuss] DW_CFA_def_cfa_expression vs DW_CFA_def_cfa_register

Roland McGrath roland@redhat.com
Fri Apr 23 04:07:01 GMT 2010


If an FDE contains:

	...
	DW_CFA_def_cfa REGNO OFFSET
	...
	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.


Thanks,
Roland




More information about the Dwarf-discuss mailing list