[Dwarf-Discuss] DWARF piece questions

Adrian Prantl aprantl at apple.com
Fri Dec 9 11:46:31 PST 2016


Here's my take on this.


> On Dec 9, 2016, at 11:11 AM, Andreas Arnez <arnez at linux.vnet.ibm.com> wrote:
> 
> Although I've already created public comments for (most of) this,
> Michael Eager suggested that I post my questions regarding DWARF pieces
> on this list (again).
> 
> All of these questions are related to the definition of DW_OP_piece and
> DW_OP_bit_piece:
> 
> * Is "DW_OP_piece(n)" equivalent to "DW_OP_bit_piece(8*n, 0)"?

I would think the answer to this is yes, and if it isn't I would really like to see the counterexample added to the Appendix.

> 
> * What is the correct placement rule for register pieces?  ABI-defined
>  or lsb0-ordered?  If lsb0-ordered, how exactly is that order defined
>  for non-integer registers?

"If the location is a register, the offset is from the least significant bit end of the register."
Does this text from the latest draft answer the question?
If not, can you give an example where it isn't?

> 
> * Shall DW_OP_bit_piece ignore the offset for stack- and implicit
>  values?

"If the location is any implicit value or stack value, the DW_OP_bit_piece operation describes a sequence of bits using the least significant bits of that value."

No.

> 
> * What is the "least significant bit" of an implicit value?  And is it
>  intentional that the placement rule differs between implicit- and
>  memory values?

I don't know.

> 
> * Some DWARF producers describe a register pair just with a single
>  DW_OP_reg<n>.  Can a register piece reach into the next register like
>  that as well?

You mean for a pair of r1,r2 they would emit only DW_OP_reg1? I don't think this use is supported by the DWARF specification.

> 
> * Is "DW_OP_reg*" followed by "DW_OP_piece(size of object type)" always
>  equivalent to omitting the piece operation?

If sizeof(obj) == sizeof(reg) it is obviously.
If sizeof(obj) > sizeof(reg) the expression is malformed because there are undefined bits in the object that should have been represented with an empty DW_OP_piece.
If sizeof(obj) < sizeof(reg) the expression is overspecified, but still sound, so I would say yes.

-- adrian

> 
> --
> Andreas
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org



More information about the Dwarf-Discuss mailing list