This is the mail archive of the dwarf2@corp.sgi.com mailing list for the dwarf2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PROPOSAL - Correct use of "factored offset" in Appendix 5


Proposal
--------

In Section 6.4.2, change "offset" to "factored offset" in the descriptions
of DW_CFA_def_cfa and DW_CFA_def_cfa_offset.

Discussion
----------

Keith Walker reported the following to me:
>
>Whilst comparing DWARF2 generated by different implementations I have come
>across the following inconsistance dues to different interpretations of
>what the DWARF2 standard meant .....
>
>Summary of the Problem
>==================
>Inconsistant wording of the usage of "factored offset" and "offset" in the
>definition of the Call Frame Instructions leading to different
>interpretations by implementators.
>
>Description
>========
>Section 6.4.1 defines the data_alignment_facter as
>	"A signed LEB128 constant that is factored out of all offset
>	instruction (see below)".
>
>Section 6.4.2 defines the following instructions which use an offset value:
>
> [ 2.]	"DW_CFA_offset
>	 takes two arguments: an unsigned LEB128 constant representing a
>	 factored offset and a register number."
>
> [ 8.]	"DW_CFA_offset_extended
>	 takes two unsigned LEB128 arguments representing a register number
>	 and a factored offset."
>
> [15.]	"DW_CFA_def_cfa
>	 takes two unsigned LEB128 arguments representing a register number
>	 and an offset."
>
> [17.]	"DW_CFA_def_cfa_offset
>	 takes a single unsigned LEB128 argument representing an offset."
>
>The way that I read this and which I believe was the intension is that all
>4 CFA instructions using data offsets should be factored by the
>data_alignment_factor.    However at least one implementation (GCC) has
>interpreded this to mean only the 2 CFA instructions which explicitly say
>"factored offset" are factored by the data_alignment_factor.
>
>Solution
>======
>Change "an offset" to "a factored offset" in the definitions of DW_CFA_cfa
>and DW_CFA_def_cfa_offset.


My Comments
-----------

Keith: can you provide the data for the other compilers you have surveyed?

I suspect that Keith is right when he suggests that all four instructions
*should* have said "factored offset". In addition to the wording in 6.4.1,
the later example FDE (in Appendix 5, address fde+17) shows the use of

    DW_CFA_def_cfa_offset(<fs>/4)

where the division by four corresponds to the data alignment factor.
(Should that really be division by -4, per my earlier mail?)

Nonetheless... I think it important to see the data regarding which
implementations have come down on which side of this ambiguity. If most
implementations in fact use unfactored offsets for DW_CFA_def_cfa and
DW_CFA_def_cfa_offset, then perhaps we should change the wording in the
opposite direction?

Keith reports that gcc does not apply the factored offset to DW_CFA_def_cfa
and DW_CFA_def_cfa_offset. For information on a second implementation, I can
report that the Compaq compilers (F90, C, C++) on Alpha Linux do likewise
(probably because we looked at gcc and followed suit!).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]