IIRC, there was/is an issue with some versions of gdb internally resolving symbolic links.
(There should be a post about this on the forum)
If that happens, you get the described effect.
Lazarus creates an App-Bundle. Inside the app bundle, where the exe is expected, it places a symbolic link, to the actial exe, which is placed outside the app bundle (not sure why).
YourProjectDir/project1.app/Contents/MacOS/project1 << symbolic link
YourProjectDir/project1 << real exe file
If GDB resolves that link, then the exe is executed *outside* the app bundle. And that gives exactly the effect you describe.
Possible solutions:
- Find a GDB that behaves (I am not sure which one, or if there is)
- Specify the name and location where the compiler creates the exe (see "project options" > "Path"), and get rid of the link