[Dwarf-discuss] Constant expressions in locations lists

David Anderson davea42@earthlink.net
Thu Mar 8 01:45:31 GMT 2007


Cary Coutant wrote:
>
> I think what it needs isn't so much a grammar as a type system. The  
> grammar for a postfix expression on a simple stack is trivial.  
> Consider introducing four types of values that can exist on the  
> stack: integers, register names, constant values, and "pieces". Now  
> each operator can be described in terms of what types of values it  
> can consume from the stack and what type of value it pushes back onto  
> the stack (if any):
>
> - The DW_OP_const* and DW_OP_lit* operators push an integer onto the  
> stack.
> - The DW_OP_reg* operators push a register name.
> - The DW_OP_constant_value operator pushes a constant value.
> - The DW_OP_piece (and DW_OP_bit_piece, if that's in yet) operator  
> can consume any one of the other three types, and pushes a "piece"  
> back onto the stack.
> - Most of the remaining operators consume one or two integers and  
> push an integer.
>   

History note:  We really intended the OP evaluation
stack to have simply 'address size integers'
and avoid such a 'type' system entirely. 
Even avoiding signed/unsigned issues (as that's not a  problem
with twos-complement). 
Not as an oversight, but as a design decision.

Whether that simple address-size-integer
value stack  is still sufficient is open to discussion, but
any type system introduces all the 'conversion' issues.

David Anderson





More information about the Dwarf-discuss mailing list