[Dwarf-Discuss] DW_OP_regX vs. DW_OP_bregX 0

Roland McGrath roland@redhat.com
Thu Feb 12 23:50:59 GMT 2009


> Furthermore, the proposed meaning of DW_OP_reg* is not precisely
> analogous; the original meaning is in effect "push the non-memory-address
> location of this register on the stack" 

I don't think it makes sense, so as to constitute support of any position,
to describe the existing standard this way.  What the existing standard
says explicitly is that DW_OP_reg* can never appear in an actual DWARF
expression--the only place where a concept of "stack" exists.  To describe
the specification this way makes inferences or implementation assumptions
that are not indicated by the standard itself.

I can draw different inferences and implementation assumptions that make
the other interpretation "natural".  Still, we are just playing semantics.

> It's more of a burden because the proposed meaning is a whole lot more
> complicated that the original meaning.  In effect, every operator would
> have to peek at the stack, and if top-of-stack is a register location,
> implicitly execute a deref.  Or, every existing consumer would have to
> be modified to change its handling of an existing operator.  Neither of
> those choices is attractive.

This encodes a great deal of assumption about implementation detail.

Let's just talk objective facts rather than slant.  We agree that the
specification today is unambiguous about the use of DW_OP_reg*: well-formed
DWARF 3 data uses register name operators only as the sole operation in a
simple location expression (including the simple location expression
constituent of a location expression using composition operators).  I think
we agree that it says nothing about interpretation of non-standard use of
DW_OP_reg*: it's just not well-formed DWARF 3 data whose meaning is specified.

As this use today is explicitly specified as being invalid, I posit that
extant consumers that are robustly implemented diagnose and reject it.  I
take it that you may posit that some extant consumer implementations may
instead be confused by encountering such an expression.

You posit that some extant implementations would find it burdensome to
support the format if amended to specify a meaning for DW_OP_reg* appearing
inside larger DWARF expressions.  The judgment of what constitutes an
unreasonable burden on implementations is left to the consensus of
implementors represented on the committee.  There appears to be a lack of
consensus that respecifying this case now specified as invalid to instead
have a specific useful meaning imposes no unreasonable burden on
implementors.  (I personally question the quality of any implementations
where the implementors would judge this an unreasonable burden, but I'm
certainly free not to use those implementations.)


Thanks,
Roland




More information about the Dwarf-discuss mailing list