Issue 201007.1: Wide Registers in Location Description Expressions

Author: Markus Metzger
Champion: Markus Metzger
Date submitted: 2020-10-07
Date revised: 2022-03-17
Date closed: 2022-03-21
Type: Enhancement
Status: Accepted with modification
DWARF Version: 6
Section 2.5.1.3, pg 29

Some architectures support registers that are wider than the DWARF stack.
Compilers may choose to store a vector of values in those registers that
are relevant for describing the location of objects, such as addresses or
offsets from a common base address.

To support extracting those values from such wide registers and using them
in DWARF expressions, we propose a family of operators.

===

Section 2.5.1.3, pg. 29.

Rephrase

    DW_OP_regval_type pushes the contents of the register together with
    the given base type, while the other operations push the result of
    adding the contents of a register to a given signed offset together
    with the generic type.

into

    DW_OP_regval_type pushes the contents of the register together with
    the given base type.  DW_OP_regval_bits pushes the partial contents of
    the register together with the generic type.  The other operations
    push the result of adding the contents of a register to a given signed
    offset together with the generic type.

Add

    5. DW_OP_regval_bits

       The DW_OP_regval_bits operation takes a single 1-byte unsigned
       integer operand, which gives the number of bits to read, which must
       be smaller or equal to the bit size of the generic type.  It pops
       the top two stack elements and interprets the top element as an
       unsigned bit offset from the least significant bit end and the
       other as a register number identifying the register from which to
       extract the value.  If the extracted value is smaller than the size
       of the generic type, it is zero extended.
 
Section 7.7.1, p223ff

Add
    DW_OP_regval_bits | 0xaa | 1 | 1-byte bit size
to Table 7.9.

--
2022-01-25: Revised.  Previous version: http://dwarfstd.org/issues/201007.1-1.html
2022-03-17:  Revised.  Removed DW_OP_regval_bits_stack_offset and DW_OP_regval_bits_stack.
   Previous version: http://dwarfstd.org/issues/201007.1-2.html
2022-03-21:  Accepted with modification:  Change ubyte operand to ULEB128.