[Dwarf-Discuss] DW_OP_regX vs. DW_OP_bregX 0

Jakub Jelinek jakub@redhat.com
Thu Feb 12 09:34:23 GMT 2009


GCC uses DW_OP_regX heavily in lots of places, e.g. in .dwarf_frame when
dynamic stack realignment is needed:
DW_CFA_expression: r7 (edi) (DW_OP_reg5; DW_OP_const1s: -8; DW_OP_and; DW_OP_const1s: -4; DW_OP_plus)
or e.g. in .dwarf_loc for
DW_OP_reg4; DW_OP_deref etc.

But I've been recently pointed at Dwarf3's 2.6.1 which seems to forbid this.
What's the rationale for it?  When DW_OP_reg5 is used alone, it has slightly
different meaning from DW_OP_breg5 0 (the former means the value can be
changed by tweaking the register, the latter is more like an rvalue), but
when it is not used alone, is there a reason why DW_OP_regX couldn't be
treated as a more compact form of DW_OP_bregX 0?

I'm afraid changing all DW_OP_regX in GCC to DW_OP_bregX 0 except for
DW_OP_regX alone in a location list will bloat the debug and unwind info a


More information about the Dwarf-discuss mailing list