[Dwarf-Discuss] Use of Location Description operations in DWARF Expressions?

Michael Eager eager@eagerm.com
Mon Mar 23 23:38:19 GMT 2020


On 3/23/20 3:58 PM, Cary Coutant via Dwarf-Discuss wrote:
>> I think that the description has become a bit less clear with the
>> addition of the Implicit Location Descriptions in Section 2.6.1.1.4,
>> which do compute values, rather than locations.  Perhaps these should
>> have been described in Section 2.5 as parts of a DWARF expression, not
>> as parts of a Location Description.
> 
> Strongly disagree. The whole point of an implicit location description
> is to give a (pseudo/virtual) location to a value that has no
> location. A DWARF *expression* has no use for these operators.

DW_OP_implicit_value and DW_OP_stack_value produce values (that is 
R-values), not locations.  I might be able to read 
DW_OP_implicit_pointer as providing a location; I'm not sure.

As I said, values and locations are muddled.  If you think that a 
variable which has been eliminated has a location which is described by 
a DW_OP_implicit_value, then we aren't working with the same definition 
of "location".

The problem is that the basic DWARF concept is that a variable has a 
location and that you can fetch its values from this location.  Thus, we 
expect to be able to evaluate a location description and dereference it 
to get a value.  Similarly, you can change a variable's value by 
modifying its location.  This dereference or modification may be a bit 
complicated if DW_OP_piece is involved, but the operation is symmetric. 
This I might call a "real" location description.

This doesn't work with any of the Implicit Location Descriptions, 
because there isn't any "there" there.  They don't result in locations; 
they give the values which would be found if the variable did exist.  So 
they implicitly perform the dereference operation.  But, in contrast to 
"real" location descriptions, the operation is not symmetric, you can't 
change the variable's value.



More information about the Dwarf-discuss mailing list