[Dwarf-discuss] Proposal: Error: DW_OP_entry_value description and examples

Jakub Jelinek jakub@redhat.com
Tue Aug 8 16:42:45 GMT 2023

On Tue, Aug 08, 2023 at 04:21:57PM +0000, Metzger, Markus T via Dwarf-discuss wrote:
> >### Section Special Operations, p.37
> >
> >The first sentence of the description of DW_OP_entry_value reads:
> >
> >    The DW_OP_entry_value operation pushes the value that the described
> >    location held upon entering the current subprogram.
> >
> >A DWARF expression does not describe a location, so this should read:
> >
> >    The DW_OP_entry_value operation evaluates an expression or register
> >    location description as if it had been evaluated upon entering the
> >    current subprogram, and pushes the value of the expression or content
> >    of the register, respectively.
> Aren't register location descriptions the only thing that, given appropriate
> unwind rules, can actually be implemented?

No.  It is certainly the most common one and the reason why the special case
But, one can also e.g. DW_OP_entry_value <DW_OP_regval_type <base_type_die, regno>>
if it is in a reg which has either size that doesn't fit into address size
or is e.g. floating point, or it should be able to describe a stack slot,
say if calling conventions pass first 6 integer arguments in registers and
then stack, one should be still able to note that it is constant 42 pushed
into that stack slot.

There are two different uses of DW_OP_entry_value.  One is to find matching
expression in the call site if it can be located and use DW_AT_call_value of
that, obviously for that the comparison doesn't compare the values but what
contains the value.  Say for DW_OP_entry_value <DW_OP_reg5> if the register
currently contains value 42 one doesn't search in call site for something
that also evaluates to value 42, but one that is the register 5.  For stack
slot addresses, one should compare the addresses though.  And then the other
way is the remember at function starts the value (so one evaluates the DWARF
expression to get the value there) and remembers it under that (register 5,
memory address 0x14958ab3454, and the like).

> Should this be restricted to only allow register location descriptions?



More information about the Dwarf-discuss mailing list