DWARF Standard


181205.1 Greg Clayton Clarify DW_OP_piece documentation for parts of values that are optimized out Clarification Open Adrian Prantl

Section, pg 42

After someone posted a bug on bugzilla for LLDB regarding LLDB not showing 
that parts of a value were optimized out (https://bugs.llvm.org/show_bug.cgi?id=39869), 
I read the documentation on DW_OP_piece for clarification on what should be done 
when part of a value is optimized out. As the comments in the bug show, there is a 
mention in the DWARF specification in " Empty Location Descriptions" that 
says something about an empty location means the value might be optimized out. 

People reading the spec must currently read this and be able to infer that a 
location like:
DW_OP_piece: 6; ...
Means that the value starts with 6 optimized out bytes. Also, these optimized out 
bytes could be in the middle of a DWARF expression. It might be nice to clarify 
usage of DW_OP_piece to specify that parts of the value are optimized out.

I currently assume that if you run into a DW_OP_piece and the expression stack is 
empty, then the bytes for the piece are optimized out. What would happen if there 
was something on the stack and you needed to specify that 4 bytes of a value were 
optimized out? 


The normative text currently is indeed missing an explanation for undefined 
values, they are only mentioned in an example in Appendix D1.3.

The last question is a misunderstanding: DW_OP_piece operates outside of the
 DWARF stack. It is not possible to leave values on the DWARF stack beyond a
 DW_OP_piece, because the DWARF stack does not exist outside of a (non-composite)
 location description.


Add the following normative text to

A composition operation that follows an empty location description indicates
 that the piece is undefined, for example because it has been optimized away.

2021-10-04:  Updated.

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2021 by DWARF Standards Committee.