Issue 050510.1: DW_AT_frame_base clarifications

Author: Jeff Nelson
Champion: Jeff Nelson
Date submitted: 2005-05-10
Date revised:
Date closed:
Type: Clarification
Status: Accepted
DWARF Version: 3
Reference: DWARF V3, Draft 9 (November 12, 2003)

Problem:

Evaluation of the DW_OP_fbreg operator requires evaluation of the
DW_AT_frame_base attribute. The description of the DW_OP_regN operator
suggests that a DW_AT_frame_base containing a single DW_OP_regN could be
interpreted as invalid. This is because--according to the DW_OP_regN
definition--DW_OP_regN "names" the register, rather than provides the
"value" of the register. The DW_OP_fbreg example in Section 2.5.3 would
seem to support this conclusion.

However, in a discussion on the DWARF mailing list in April 2005,
several DWARF adopters reported that they have firmly established the
convention of interpreting DW_AT_frame_base to be the register value
when the attribute contains just DW_OP_regN. This practice needs to be
codified.

In addition, the description of DW_AT_frame_base in Section 3.3.5
neglects to explain how the attribute should be interpreted if it is a
location list. Note that location lists were clearly envisioned by the
description of DW_OP_fbreg in Section 2.4.1.2.


Proposal:

Change the second paragraph of Section 3.3.5 from:

    A subroutine or entry point entry may also have a DW_AT_frame_base
    attribute, whose value is a location description that
    computes the “frame base” for the subroutine or entry point.

to the wording suggested by Jim Blandy and Ron Brender:

    A subroutine or entry point may also have a DW_AT_frame_base
    attribute, whose value is a location description that
    computes the "frame base" for the subroutine or entry point.
    If the location description is a register name, that register
    contains the frame base address.  If the location description
    is a DWARF expression, then the result of evaluating that
    expression is the frame base address. Finally, for a
    location list, this interpretation applies to each location
    expression contained in the list of location list entries.