[Dwarf-Discuss] DWARF piece questions

Andreas Arnez arnez@linux.vnet.ibm.com
Fri Jan 27 19:29:59 GMT 2017


On Thu, Jan 26 2017, Andrew Cagney wrote:

>> I thought your example specifically addressed DW_OP_piece (not
>> DW_OP_bit_piece), and that it illustrated the usefulness of involving
>> the resulting object's DW_AT_type into the ABI-dependent placement rule.
>> If that's what you meant, then the example is flawed.  If that's *not*
>> what you meant, then the example is probably misleading (at least to
>> me).  So I suggest to use a different example, or to adjust it so it
>> actually works.
>
> You've lost me here.

Sorry about that.  Let's try again.  We were discussing your suggestion
for non-normative text:

  / For instance, so that structure variables passed by register can be
  loaded and stored using register-sized transfers, a big-endian ABI may
  specify that the pieces of a structure are "left aligned" within a
  register (located in the most significant bytes of the register). /

I understood that this suggests, for instance, to express the location
of a 12-byte structure variable that was passed via the two 64-bit
registers 4 and 5 as:

  DW_OP_reg4 DW_OP_piece(8) DW_OP_reg5 DW_OP_piece(4)

And that the second piece above would then refer to the *most*
significant bytes of DWARF register 5.

But wouldn't DW_OP_piece(4) be similarly useful for a structure's "int"
field that was optimized into a register?  Only that the piece operation
now refers to the *least* significant bytes of that register, which
doesn't match the above.  So only one of those cases can be covered by
the ABI specification.  Thus the example is flawed, because it appears
to make a case for a useful scenario, but it doesn't.

Or if that was not the point of the example, then the example is
misleading (to me), because then I obviously understood it wrong.

>> Yes, here the DWARF standard gives a useful explanation of the intended
>> use and interpretation of register numbers.  But it does not give any
>> hint about placement *within* a register.  I'm just saying that a
>> similar clarification might be useful for that aspect as well.
>
> Hopefully the instruction set architecture manual, that the abi and
> DWARF register map are all tied to answers this (or failing that
> wikipedia https://en.wikipedia.org/wiki/Extended_precision )

What?  You expect the ISA to define anything related to DWARF?  I've
never seen that.  I also don't understand how the Wikipedia article
about extended precision is related to the DW_OP_reg* operation at all.

I am specifically addressing the text on page 40 in 2.6.1.1.3 "Register
Location Descriptions" in the DWARF5 public review draft:

  1. DW_OP_reg0, DW_OP_reg1, ..., DW_OP_reg31

  The DW_OP_reg<n> operations encode the names of up to 32 registers,
  numbered from 0 through 31, inclusive. The object addressed is in
  register n.

Where I suggest to add something like: "The placement of the object
within the register is defined by the ABI."  There are mainly two
reasons for this:

* There's at least one case where the current definition was
  misinterpreted.  See Adrian Prantl's mail from March last year:
  http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/2016-March/004201.html

* This clarification would bring it on the same level of detail as the
  definition of DW_OP_piece.

--
Andreas




More information about the Dwarf-discuss mailing list