[Dwarf-Discuss] DW_OP_regX vs. DW_OP_bregX 0

Cary Coutant ccoutant at gmail.com
Thu Feb 12 16:38:03 PST 2009


> 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.)

What you're suggesting is that

  DW_OP_reg0

and

  DW_OP_reg0 DW_OP_lit0 DW_OP_plus

will have very different meanings, because now there's an implicit
"deref" of the register location simply because it's embedded in a
larger expression. Regardless of how easy it may be to describe and
implement such an interpretation, I'm not prepared to accept it as a
valid expression. Besides the conceptual ugliness -- which I am
reluctantly prepared to ignore if necessary -- I think there's a
strong likelihood that bending the rules in this case will lead to
differing implementations (as, in fact, it seems to have done
already). Corner cases will arise: will everyone implement it
correctly when DW_OP_reg* is embedded within a DW_OP_piece? Can we
anticipate all possible misinterpretations of the rule and head them
off?

The distinction between DW_OP_reg* and DW_OP_breg*, even though quite
crisp, still commonly causes confusion. I think any attempt to define
the operators the way you suggest will only deepen that confusion and
increase the chance of two vendors implementing it differently.

The alternative of using

  DW_OP_breg* 0

to fetch the contents of a register is perfectly reasonable in the
absence of any evidence to show that the extra 0 byte contributes
significantly to DWARF bloat. Until we have such evidence, why not
keep things simple?

-cary



More information about the Dwarf-Discuss mailing list