DWARF Standard


191025.1 Paul T Robinson DW_OP_bit_piece offset operand mostly does matter Editorial Open Paul T Robinson

Section, pg 42
The description of DW_OP_bit_piece lists several cases for the preceding 
location description:
- empty (no location description)
- register
- implicit or stack value
- memory address

For the empty case, the spec explicitly says the bit offset operand 
"doesn't matter."  For implicit value or stack value, the piece must 
use the least significant bits; in these cases, the bit offset again 
doesn't matter, although the spec doesn't say so in so many words.

In fact, there is an argument that for the implicit value descriptions
(implicit value, stack value, implicit pointer), the offset operand
could be useful, as a substitute for an explicit shift operation.


(For clarity in discussing the changes, I've presented each sentence
individually, and indicated whether the proposal changes it.  I feel
that presenting the entire paragraph is helpful, but presenting it in
one lump made it hard to identify the proposed changes.)

Interpretation of the offset depends on the location description.

If the location description is empty, the DW_OP_bit_piece operation
describes a piece consisting of the given number of bits whose values
are undefined, and the offset is ignored.
(reworded, no semantic change)

(third sentence [register case] removed)

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

In all other cases, the source of the piece is either a register or an
implicit value description (section; the offset is from the
least significant bit of the register or implicit value.

2021-02-22 Revised.
2021-03-23 Revised.  Previous version: http://dwarfstd.org/ShowIssue.php?issue=191025.1-1
2021-04-19 Revised.  Previous version: http://dwarfstd.org/ShowIssue.php?issue=191025.1-2

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.