Recent

Author Topic: Ensuring all libraries (incl. FCL and LCL) are debug-free  (Read 467 times)

Nimral

  • Sr. Member
  • ****
  • Posts: 253
  • Keep it simple.
Ensuring all libraries (incl. FCL and LCL) are debug-free
« on: May 30, 2022, 10:51:50 am »
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.

« Last Edit: May 30, 2022, 11:02:36 am by Nimral »
Lazarus 2.2.0 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10291
  • FPC developer.
Re: Ensuring all libraries (incl. FCL and LCL) are debug-free
« Reply #1 on: May 30, 2022, 02:53:32 pm »
Moderator note: removed a abusive post of some user.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8260
  • Debugger - SynEdit - and more
    • wiki
Re: Ensuring all libraries (incl. FCL and LCL) are debug-free
« Reply #2 on: May 30, 2022, 04:14:59 pm »
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)


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10291
  • FPC developer.
Re: Ensuring all libraries (incl. FCL and LCL) are debug-free
« Reply #3 on: May 30, 2022, 04:18:09 pm »
And specific debug code under {$ifdef debug}

 

TinyPortal © 2005-2018