I have a C code executable for Linux.
For release, I can have two options:
One is build with -g -O3, strip the debug (strip -g) and send the output as release.
Second is build the release directly with -O3.
The advantage of the first option, if I understand correctly, is that I can use the exe before the stripping for remote debugging or for analyzing core dumps.
The question is if there is any disadvantages in this approachi.e., is there run time performance overhead of building with -g and then stripping
thanks.
There is no run time performance hit for using
-g. The debug info lives in a separate section of the executable, which wont even be loaded if you execute the file.But you can separate debug info and executables if you wish (which still won’t make any performance difference). My Gentoo Linux handles it this way, the reason is simply minimizing used disk space which allows me having all binaries on a small fast disk while still keeping the debug info, which is alomst never used, in a separate partition.
Now you have a foo executable and a foo.debug which contains debug symbols.