[Dwarf-discuss] DW_OP_piece limits and assumptions
Daniel Jacobowitz
drow
Thu Apr 28 09:31:52 GMT 2005
On Wed, Apr 27, 2005 at 06:06:29PM -0500, jeff nelson wrote:
> If you follow the strict interpretation of DW_OP_piece, the expression
> ought to result in TWO values, not one. That is, when you reach the
> second DW_OP_piece, what definition or rule do you use to combine it's
> value with the results of the first DW_OP_piece?
>
> To resolve this issue, I propose the following addition to the
> description of DW_OP_piece:
>
> DW_OP_piece is a context-sensitive operator. For the first occurance
> of DW_OP_piece in a DWARF expression, the operator result is pushed
> on the DWARF expression stack. For all remaining occurances, the
> operator result is appended to the value at the top of the stack. In
> this way, the results of several consecutive DW_OP_piece operations
> are combined into a single value.
>
> Note that:
> a) "appended" is undefined.
>
> b) I make the simplifying assumption that the the operator result is
> saved on the stack (i.e., leaving questions 1 and 2 above unresolved for
> now).
This is obviously a result of the same disagreements about how location
expressions are handled that came up in the earlier discussion :-)
Could you explain why you believe the result of DW_OP_piece belongs on
the stack? Here's my interpretation:
Consider this location expression:
DW_OP_fbreg 20
The resulting object can be of any size, and is never put onto the
stack. Then consider this one:
DW_OP_fbreg 20 DW_OP_piece 32 DW_OP_fbreg 70 DW_OP_piece 4
The resulting object is 36 bytes. Conventionally (though I think this
is not explicit in the standard) it is built up in memory order. When
we reach the first DW_OP_piece, fp+20 is on the stack; DW_OP_piece
consumes that. It does not need to place a new value on the stack.
Instead it records some information for the evaluator of the location
description. There is no way for further stack operations to get at
the value.
--
Daniel Jacobowitz
CodeSourcery, LLC
More information about the Dwarf-discuss
mailing list