DWARF Standard


161206.2 Andreas Arnez Clarify relationship between DW_OP_piece and DW_OP_bit_piece Clarification Deferred to Ver. 6

Section, pg 42
The current specifications of DW_OP_piece and DW_OP_bit_piece do not
make it sufficiently clear whether DW_OP_piece is just a
backward-compatible short-hand notation for special cases of
DW_OP_bit_piece.  All DWARF producers/consumers I know of interpret it
that way, but the current specification says otherwise:

- DW_OP_piece: "If the piece is located in a register, but does not
  occupy the entire register, the placement of the piece within that
  register is defined by the ABI."
- DW_OP_bit_piece: "If the location is a register, the offset is from
  the least significant bit end of the register."

This wording seems to imply that byte- and bit pieces may follow
different rules for the placement of pieces within a register, one
defined by the ABI, and the other being the LSB0 rule defined by

Also, placement rules for other types of objects are only given for
DW_OP_bit_piece and missing for DW_OP_piece.

Thus I propose to clarify the specification of DW_OP_piece in
"Composite Location Descriptions":

      1. DW_OP_piece

      The DW_OP_piece operation takes a single operand, which is
      an unsigned LEB128 number.  The number gives the size in
      bytes of the piece of the object referenced by the
      preceding simple location description.  The placement of
      the piece within that object is the same as defined by the
      appropriate DW_OP_bit_piece operation with offset zero.
      Thus the following operations are equivalent:
      - DW_OP_piece <n>
      - DW_OP_bit_piece <8*n> 0

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