[Dwarf-Discuss] DW_CFA_def_cfa_expression vs DW_CFA_def_cfa_register

Michael Eager eager@eagercon.com
Fri Apr 23 15:32:11 GMT 2010


Roland McGrath wrote:
>> There is nothing in the description of DW_CFA_* to suggest that there are
>> any hidden values, a stack for CFA definitions, or that any previous register
>> or offset values that are no longer valid are somehow reinstated.
>>
>> Following DW_DEF_cfa_expression, there are no saved or hidden register
>> or offset values.  There is simply an expression used to compute the CFA.
> 
> That's how I had read it before.  If that's the intent of the standard, I
> think the wording for DW_CFA_def_cfa_* should be explicit about it.  That
> is, say that DW_CFA_def_cfa_{register,offset,offset_sf} are invalid after
> DW_CFA_def_expression (or at the initial state) without an intervening
> DW_CFA_def_cfa.
> 

Feel free to submit wording which you think would make this clear
on the issues page at dwarfstd.org.

>> In your example, I would suggest that following a DW_DEF_cfa_expression,
>> you use DW_CFA_def_cfa with a register and offset.  If you intend the
>> offset to be zero, you should specify it explicitly.
> 
> I wasn't asking as a potential producer, but as a consumer.  The example I
> gave was one GCC emitted.  Other consumers apparently don't have a problem
> with this in practice.  Whether that was intended or is happenstance,
> either in existing consumers or in GCC as the producer, is not clear to me.
> 
> For example, GDB's CFI processor does save the "hidden" register number
> and/or offset value.  There is no comment about it I've seen, so it seems
> as likely as anything that this is just happenstance of how it stores its
> state.  My CFI processor used a union where GDB uses sibling struct members
> (so loses the "hidden" state), and diagnosed such sequences as invalid.  So
> my processor refused to work on an FDE that at least one other processor
> did work on.
> 
> If the conclusion is that this is indeed invalid and GCC is buggy to emit
> it, that is fine by me.
> 
> 
> Thanks,
> Roland
> 


-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077




More information about the Dwarf-discuss mailing list