[Dwarf-Discuss] DW_OP_regX vs. DW_OP_bregX 0

Roland McGrath roland@redhat.com
Thu Feb 12 22:24:07 GMT 2009


> GCC is producing nonstandard expressions.

That is not in dispute.

> If the 0 offset happens really a lot, it could be worth doing something
> about it.  Blessing GCC's current behavior doesn't feel right, though,
> as it overloads DW_OP_regN to mean one thing when used by itself and 
> another thing when embedded in a larger expression.  

One could say that DW_OP_addr is overloaded in the same way.
Alone it means "this address is the location".  Embedded it
means "push this address on the expression stack".  The two
(proposed) meanings for DW_OP_reg* are precisely analogous.

> This puts an unnecessary burden on the interpreter.

How so?  I think it is clear and unambiguous what DW_OP_reg* would mean in
this case if not specifically disallowed.  How is this more of a burden
than the use of any other new operation?

> I might rather suggest a new set of operators, say DW_OP_cregN, which
> are exactly equivalent to DW_OP_bregN 0.  (creg = content of register.)

Swallowing 32 values from the available one-byte opcodes does not seem like
a very good trade-off here.  The only benefit gained is the lack of the
so-called "burden" of treating DW_OP_reg* used inside larger expressions in
the obvious manner.


Thanks,
Roland





More information about the Dwarf-discuss mailing list