[Dwarf-discuss] Interpretation of FBREG: implied deref of frame_base?

Jim Blandy jimb
Thu Apr 21 19:39:10 GMT 2005


brender at gemevn.zko.dec.com (Ron 603-884-2088) writes:

> it seems better to incorporate the explanation in the frame base
> attribute description proper.

I agree.

> The current description of DW_AT_frame_base (Section 3.3.5, page
> 46 of V3) reads:
> 
>     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.

How about replacing it with this:

      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.  Otherwise, the location
+     description must leave a value on the stack, wich the frame base
+     address.

I think the first paragraph of section 2.5.1, "Register Name
Operators", spells out some stuff that clarifies all this:

    The following DWARF operators can be used to name a register.
    They can be used only in location expressions.  Each register name
    operator must be used alone (as a DWARF expression consisting of
    just that one operation).

and similarly in 2.5.2, "Location Expressions":

    The location operations fall into two categories, register names
    and addressing operations.

In other words, location expressions that are register names are just
a different kind of beast from other DWARF expressions: they're never
part of a larger expression (except for DW_OP_piece), and are used to
describe objects that lack addresses altogether.

So it's not a question of when and when not to dereference.  Rather,
there are two different categories of location expression, and we need
to assign an interpretation to each when it appears as the value of a
DW_AT_frame_base attribute.  The only thing one can reasonably do with
a register name is to look at the named register's contents.

(I'm left wondering why the original description of DW_AT_frame_base
specifies that its value is a location description, instead of a DWARF
expression, if not to explicitly allow the use of DW_OP_reg*
operators.  That's the only distinction between location expressions
and DWARF expressions.)





More information about the Dwarf-discuss mailing list