[Dwarf-Discuss] Use of Location Description operations in DWARF Expressions?
Fri Mar 20 00:49:41 GMT 2020
On 3/19/20 9:30 AM, David Stenberg via Dwarf-Discuss wrote:
> This is something that has popped up in a number of LLVM patch reviews,
> and is something that we would like to get some help with clarifying.
> For DWARF, may a DWARF Expression (described in section 2.5)
> contain any of the operations listed under the Location Descriptions
> section (2.6)? For example, may a DW_AT_call_value in DWARF5, which
> "is a DWARF expression", contain any of those operations
> (e.g. a DW_OP_piece)?
> DWARF5 section 2.5 specifies the following for the operations under
> section 2.6:
> "In addition to the general operations that are defined here, operations
> that are specific to location descriptions are defined in Section 2.6
> on page 38."
> Reading section 2.5 and 2.6, I have interpreted the standard as if DWARF
> Expressions and Location Descriptions are disparate things; Location
> Descriptions may describe locations _using_ DWARF Expressions, but in
> places where a DWARF Expression is expected, you may not have a Location
> Description in its place. Is that correct?
> Given the above quote, and if my interpretation of how DWARF Expressions
> and Location Descriptions correlate is correct, I would assume that the
> answer to this mail's initial question is no. Or am I overlooking
> somethere here?
My reading of sections 2.5 & 2.6 is that you cannot have a DW_OP_piece
in an DWARF expression.
A DWARF expression, when evaluated (as the result of evaluating a
DW_AT_call_value), yields a value which is at the top of the stack.
A Composite Location Description, containing DW_OP_piece, as mentioned
on page 42, "does not compute a value or store any result on the DWARF
The DW_OP_reg* operations in a Location Description name a register, but
do not modify the stack. (See comment page 40.)
Implicit Location Descriptions may only appear in Location Descriptions.
The wording of the text says that the three operations specify a
value, but do not say that this value is pushed on the stack.
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306
More information about the Dwarf-discuss