[fpc-devel] Wrong debug info when using clang backend
Jonas Maebe
jonas at freepascal.org
Wed Dec 6 22:25:45 CET 2023
On 06/12/2023 22:17, Martin Frb via fpc-devel wrote:
> If I have enough code, so clang does not optimize the entire function
> away in -O1, then clang writes info for some of the lines.
> Actually the variable is in a (or several?) registers.
> And clang misses some lines too.
> But it covers some lines in the procedure.
https://releases.llvm.org/11.0.0/docs/SourceLevelDebugging.html#format-common-intrinsics
states that llvm.dbg.declare is identical to llvm.dbg.addr, except that
it works badly in the context of optimisations, and that as a result it
is deprecated and will be removed.
Because of this reason, FPC only uses llvm.dbg.addr. But clang still
uses llvm.dbg.declare, and when I change FPC to use that one, the debug
info for the variables in your test program is correct. So I'll change
FPC to also use llvm.dbg.declare.
Jonas
More information about the fpc-devel
mailing list