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

Ron 603-884-2088 brender
Fri Apr 22 11:38:00 GMT 2005


Many thanks to those that have contributed to this "what's in
a name" discussion. I am often fascinated by how subtle it can
be to get the base concepts and vocabulary just right so you
can say what you mean and mean what you say without ambiguity.
No small challenge!

My own mental model goes like this: the set of locations on
a machine is the union of the set of registers together with
the set of memory cells. The DW_OP_reg5 operator "merely"
pushes the reg5 "value" from that set on the stack. The
DW_OP_deref can apply to that value just like it can be applied
to any other member of the set.

There are two downsides to this model:

  - DWARF doesn't present it that way
  - For a machine with 2**n memory cells, one needs 2**(n+1)
    "names" for the members of the set. Which is awkward in
    a way, because DWARF says that its stack consists of
    address sized elements suggesting that they would be,
    for example, 32 bits wide on a "32-bit machine" (rather
    than 33-bits wide).

But enough of such pins and angels...

I rather like wording along the lines suggested by Jim. Here is
my suggested adaptation:

      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
o     is a DWARF expression, then the result of evaluating that
o     expression is the frame base address. Finally, for a
o     location list, this interpretation applies to each location
o     expression contained in the list of location list entries.

Note: + => from Jim, o => from me.

I think this wording directly says what we mean without needing
to get entangled in vocabulary, or whether this is or is not
some kind of special case.

Note that I added the last sentence to make clear that saying the
value of the DW_AT_frame_base is a location *description* (not
just an expression) is deliberate. The possibility of a location
list is clearly called out in the description of DW_OP_fbreg
(see 2.4.1.2, p15).

Does this work for everybody?

Ron





More information about the Dwarf-discuss mailing list