[fpc-devel] DWARF info may be incorrect for location-expression, when value is in register
fpc at mfriebe.de
Sat Oct 23 15:43:17 CEST 2021
On 23/10/2021 14:04, Martin via fpc-devel wrote:
> Could anyone from the team comment on the following issue please?
> It seems with -O2 FPC may set the location of a variable to a register
> (which is correct).
> But it then attempts
> DW_OP_push_object_address, DW_OP_deref
> which may not be correct (not sure, but read my big comment on the issue)
> While -O2 is normally not for debugging, it may still be desirable
> that debug info is at least conform to the DWARF standard.
Looking at GDB.
From what I can see, current gdb (git main) fails in the IDE, on the
"ptype s", because the upper bound is expected to be a constant, but it
is not. (gdb bug)
Outside the IDE "p S" returns without error, but empty result.
I looked at the code "expr.c"
DW_OP_deref will always call
this->read_mem (buf, addr, addr_size);
So even if it gets a value from the register, gdb (most likely) would
not take the register content as the deref value, but deref it again.
More information about the fpc-devel