FPC emits wrong line info (special opcode *before* set file name)

EDIT (by Martin): see comments below. The issue is caused because of addresses are attributed to the wrong file. This is caused by the file name being set to late.
freepascal.org/lazarus/lazarus#41042 (comment 2019917397)


Lazarus🐅Trunk + FPC🤖Trunk

&

Lazarus🐅3.4 + FPC🤖3.2.2

What systems and options I checked out:

  • Win11x64+LazarusTrunk+FPCTrunk (x64 build mode)(FpDebug+GDB) - there is a bug 🐞
  • Win11x64+Lazarus3.4+FPC3.2.2 (x64 and x32 build mode)(FpDebug) - there is a bug 🐞
  • Ubuntu22.04+LazarusTrunk+FPCTrunk(FpDebug) - NO bug

To repeat the bug, you need to:

  1. open the project in the attached file
  2. the breakpoint is already set there
  3. start the project for execution
  4. you can see that for some reason the breakpoint is not in the right place at all
  5. you can slightly modify the file (literally by deleting 1 empty line (higher to the beginning), for example...) and the breakpoint becomes in the right place now

dwarf.zip

An image to attract attention:

изображение

Edited by Martin