Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-10

DWARF info may be incorrect for location-expression, when value is in register

3 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

Could anyone from the team comment on the following issue please? https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/28

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.

Reply by email

Martin

Could anyone from the team comment on the following issue please? https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/28

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.

Reply by email

Martin
to Martin
Martin wrote 11 lines
Could anyone from the team comment on the following issue please? https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/28 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.

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.

Reply by email