[Dwarf-discuss] Constant expressions in locations lists

Jim Blandy jimb@red-bean.com
Wed Mar 7 18:42:34 GMT 2007


On 3/7/07, Cary Coutant <cary at cup.hp.com> wrote:
> I propose to add a new "DW_OP_addressof" operator (it could also be
> named "DW_OP_ref" or "DW_OP_lvalue" -- I haven't picked a favorite
> yet) that would turn the value on the top of the stack into a
> reference to that constant value. A location expression ending with
> this operator would be valid anywhere a DW_OP_regx operator is valid,
> and could also be applied to the portion of a location expression
> described by DW_OP_piece.

I think an expression operator might be a nice way to solve this, but
DW_OP_addressof has some difficulties.  The values on the stack are
always address-sized, so you would have difficulty producing constant
values of floating-point, very large integer, or structure types.

Perhaps an operator DW_OP_constant, followed by an LEB128 size,
followed by that many bytes of data in target form, permitted to
appear wherever a location expression may occur.

(The spec really needs a grammar for location expressions; writing out
grammar rules in English is clumsy.)




More information about the Dwarf-discuss mailing list