[Dwarf-discuss] Interpretation of FBREG: implied deref of frame_base?

Daniel Jacobowitz drow
Mon Apr 18 15:54:30 GMT 2005


On Mon, Apr 18, 2005 at 02:38:16PM -0500, jeff nelson wrote:
> I'm a debugger developer on OpenVMS. One of the compilers I support is
> emitting a DW_AT_base_frame attribute that contains a single operator,
> DW_OP_regx. I believe this is incorrect, and that the compiler should
> emit a DW_OP_bregx instead. The difference is that the regx operator
> "names" the register whereas bregx resolves to the register value.
> 
> The distinction is important when evaluating the DW_OP_fbreg operator.
> In the case where regx is used, the fbreg operator must implicitly
> dereference the base_frame value; in the case where bregx is used, the
> frame_base value must not be dereferenced.
> 
> Unfortunately, the code on which this compiler is based has been
> emitting the DW_AT_frame_base attribute like this for years, so I'm
> faced with inertia / precedent to overcome.
> 
> I'm looking for confirmation that my interpretation of the Dwarf spec is
> correct. On the other hand, if everyone else is interpreting the spec
> contrary to how I read it, then I'll make the debugger conform to the
> actual implementation and will request a change to the spec to make it
> clear what is expected.

My interpretation is that the compiler is correct.  The value of
DW_AT_frame_base is a location description; DW_OP_reg1 means "the frame
base is stored in reg1", and DW_OP_breg1 0 means "the address of the
frame base is value_of_reg1 + 0".  If it's a register, "dereference" it
automatically.

That's what the GNU tools seem to do, anyway.

-- 
Daniel Jacobowitz
CodeSourcery, LLC




More information about the Dwarf-discuss mailing list