Issue 050518.1: DW_OP_bit_piece

Author: John Bishop
Champion: John Bishop
Date submitted: 2005-05-18
Date revised:
Date closed:
Type: Enhancement
Status: Accepted
DWARF Version: 3
Section: 2.4.1.6
Page: 20

This introduces a new operator intended to extract bit fields
from values to construct a bigger value.

1. Replace "two" by "three" in the first line.

2. Re-number DW_OP_nop as "3" rather than "2".

3. Add the following text:

---[ begin ]---
2. DW_OP_bit_piece

DW_OP_bit_piece takes two operands.  The first is an unsigned LEB128
that gives the size in bits of the field, and the second is an unsigned
LEB128 that gives the offset in bits from the low-bit end of the DWARF
expression whose result is at the top of the stack.

*DW_OP_bit_piece is to be used instead of DW_OP_piece when the pieces to
be assembled into a value are not byte-sized or are not at the start of
a register or an addressable unit of memory and so must be extracted 
from somewhere "inside" that unit.*

============================================

Revised italic text:

*Interpretation of the offset depends on the kind of
    location expression.  If the location is null, the
    offset doesn't matter and the DW_OP_bit_piece operator
    describes a piece consisting of the given number of bits
    whose values are undefined.

    If the location is a register, the offset is from the low-bit
    end of the register.

    If the location is a memory address,
    the DW_OP_bit_piece operator describes a sequence of bits
    relative to the location whose address is on the top of the
    stack using the bit numbering and direction conventions that
    are appropriate to the current language on the target system.

DW_OP_bit_piece is to be used instead of DW_OP_piece when the pieces to
be assembled into a value or assigned to are not byte-sized or are not
at the start of a register or an addressable unit of memory.  

Whether or not the result is sign-extended depends on the type of
the assembed object.*