[Dwarf-Discuss] Possible ambiguity with DW_CFA_remember_state/store_state

John DelSignore jdelsign at totalviewtech.com
Fri Jun 12 16:46:34 PDT 2009

FWIW, TotalView saves the CFA along with the explicitly-numbered registers. So, it seems that TotalView and GDB agree, and that GCC is the outlier. IMHO, it's two against one, so GCC should be fixed.

In any case, we should try to find out how other compilers (if any) currently interpret DW_CFA_remember_state so that we don't create a situation where the debugger has to figure out how each compiler vendor interprets it, for example, where compilers X, Y and Z do it one way, and compilers A, B and C do it the other way.

Cheers, John D.

Cary Coutant wrote:
> In the description of DW_CFA_remember_state, the DWARF3 spec says this:
>>   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.
> I can't find any text that explicitly says that "every register" is
> intended to include the virtual CFA register itself, but the
> description of the abstract CFI table in Section 6.4.1 subtly implies
> it by including CFA as one of the columns along with all the
> explicitly-numbered registers:
>>   Abstractly, this mechanism describes a very large table that has the following structure:
>>   LOC CFA R0 R1 ... RN
>>   L0
>>   L1
>>   ...
>>   LN
> Unfortunately, these operators were interpreted one way for gcc (save
> the CFA along with all the other registers), and the other way for gdb
> (save only the explicitly-numbered registers, but not the CFA). This
> has caused a regression in the gdb testsuite with a fairly recent
> patch to gcc mainline, and a patch is being submitted to fix gdb based
> on my interpretation that CFA ought to be saved.
> Does anyone disagree with this interpretation? Should we fix gcc instead?
> -cary
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org

More information about the Dwarf-Discuss mailing list