Issue 161109.2: Add DW_OP_call* alternative to refer to variable value
Section 22.214.171.124, pg 36
With the link time optimization debug info generation where we want to emit
debug info for types/variables etc. early and only afterwards ammend it with
additional information (locations etc.), we ran into a problem similar to
Issue 160811.1, but where we need the
value of some local variable (in PR 77589 for
DW_AT_byte_stride location expression that is on a type).
call_ref aren't IMHO usable here, because to use those in the
middle of DWARF expressions it is needed that the referenced DIE's
DW_AT_location is actually a valid DWARF expression (and additionally that
it as a result adds exactly one new value on the DWARF stack and ideally
doesn't use any earlier stack slots).
That is not the case in many cases though, the variable could have
as its location description, or DWARF expression followed by
or could not have
DW_AT_location at all and have instead
etc. When the producer can see the
DW_AT_location of the DIE referenced by
DW_OP_call* together with the DWARF expression where it wants to use
it can either inline the expression there, tweak it for the
DW_OP_breg* 0, etc. But if it is different
producer that emits the
DW_OP_call* and different one that adds
for the referenced var, then this doesn't really work.
I think it would be useful to have a
DW_OP_call* like operator that would not
evaluate the expression from the referenced DIE, but where the producer would
compute the variable's value and push that value into DWARF stack. Most
likely it would make sense only for integral variables, but that is most
likely all where it is needed.