https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77589

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to rguent...@suse.de from comment #4)
> So DW_OP_GNU_implicit_ptr doesn't work here?  Not sure
> I understand how DW_OP_GNU_implicit_ptr works fully.  That is,
> 
>   ... *(D#1 + 24)
>   DW_OP_GNU_implicit_ptr <span.0> + 0
>   DW_OP_mul
> 
> the examples in the specification always finish the dwarf expression
> with DW_OP_GNU_implicit_ptr which wouldn't be the case here.

No, it doesn't, for 2 reasons:
1) DW_OP_implicit_ptr (DWARF5) / DW_OP_GNU_implicit_ptr (GNU) is a DWARF
location description op, so can't appear in the middle of DWARF expression, but
has to appear on its own; it has a bias argument, so you can say that
int a = 5;
char *b = ((char *) &a) + 2;
b has DW_AT_location DW_OP_GNU_implicit_ptr <a, 2>, but that is it; it is like
DW_OP_reg* or DW_OP_stack_value that can't appear in the middle, and more like
DW_OP_reg* which also has to appear on its own (or say combined through
DW_OP_piece).
2) it doesn't give you the value, but the address of the referenced DIE.  So,
if 1) wasn't a problem, you'd need ... DW_OP_implicit_ptr <span.0> DW_OP_deref
DW_OP_mul to get the value and multiply.

I've proposed DW_OP_variable_value for this, will see if I get any feedback on
that.

Reply via email to