Forum > Debugger

Ensuring all libraries (incl. FCL and LCL) are debug-free


Ok, I got a follow-up problem.

From your answers to my previous question about how to debug libraries I learned that, unfortunately, Lazarus does not have a way to turn on/off debugging (incl. optimization settings) for all libraries and packages contributing to the final .exe.

Since I needed to debug into the FCL, I started to use a secondary Lazarus install (via fpcupdeluxe), compiled with -g -gw2 -O-, and it seems to do the trick when it comes to debugging - I can now step into FCL calls and I finally got my problem resolved with ease. Great, and another example that "Open Source" is a great if not indispensable aid for debugging.

The downside ist, however, that the build chain is now somewhat broken, if I switch between two Lazarus installations. Is it guaranteed and checked that, when I finally do a "Clean up and build" using the non-debug Lazarus installation in "Release" mode, absolutely no debug information is contained in the final exe, neither in my software, any included unit, the LCL, the FCL or any other package involved?

It contributes to my suspicion, that the final exe I have after a build differs only 5% in size between a debug and a release build (635 vs. 599KB)

Besides of LCL and FCL, I am also suspicious regarding packages downloaded by OPM. As far as I have seen, all packages are downloaded and compiled into one single directory (Windows: my user %APPDATA%\Local\Lazarus directory), there seems to be no separation of packages compiled with different Lazarus installations, and there seems to be no file structure distinguishing between a debug and a release build of a library.

Can I trust the Lazarus build process that it can handle this, and how can I check (just to be sure)?

Thnks again, Armin.

Moderator note: removed a abusive post of some user.

You can use "strip.exe" to make sure there are no debug symbols in your exe.
That is the names of your units, variables, procedures, ....

Strip also may remove left overs from the linker....

Though, well, your exe will contain RTTI. That is not for debugging, but for runtime. And it can contain unit names, class names, and some other names...

Also, there is (or should be) more of a difference between a debug and release build.
- A debug build should have assertions, and run-time checks ( -Criot ) => A release may not have that, or maybe a subset.
- A debug build would be -O- while releases may be -O2 or higher.

Using "additions and overrides" for all packages (does not include rtl / fcl) you can specify any optimization.
Afaik you can also disable run time checks like -Cr- -Ci- .... (but better double check that)

And specific debug code under {$ifdef debug}


[0] Message Index

Go to full version