Re: Patch: Dwarf2 reader -vs- DW_OP_piece

Jim Blandy
2002-02-24T06:15:14Z

That makes sense.

Could you change your patch to detect that pattern, verify that the
register numbers are consecutive (according to DWARF2_REG_TO_REGNUM),
return the number of the first register if everything seems right, and
give a dwarf2_complex_location_expr complaint otherwise?

This is a bit more work, but it's more correct.

Tom Tromey <tromey@redhat.com> writes:

> >>>>> "Jim" == Jim Blandy <jimb@redhat.com> writes:
>
> Jim> Can you explain what sorts of location expressions this is
> Jim> supposed to help GDB handle?
>
> Yes, sorry.
>
> Suppose a value spans multiple registers. Currently gcc encodes this
> as DW_OP_reg for the first register. However, I believe that is not
> fully correct according to the Dwarf-2 spec.
>
> The gcc patch changes the output in this case to a series of
> DW_OP_reg/DW_OP_piece instructions.
>
> So previously gcc could generate this for a `long long' value (on x86
> Linux):
>
> DW_OP_reg1
>
> With the patch gcc will now generate:
>
> DW_OP_reg1
> DW_OP_piece 4
> DW_OP_reg2
> DW_OP_piece 4
>
> Tom