[Interest] Optimizations in debug configuration

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Sep 23 01:19:04 CEST 2016


Hi,

Il 23/09/2016 00:52, Konstantin Shegunov ha scritto:
> What's the rationale of having -O2 for debug builds on Linux (g++)? As
> the compiler moves the assembly around it becomes hell stepping through
> with the debugger. Is the flag passed intentionally (and why)?

This kind of builds ("profile" builds, or "release with debug info") is
not usually used to step, rather to be able to profile the application
and still be able to map costs to the correct functions / lines in the
original source. Running profilers on unoptimized binaries is absolutely
pointless.

(Then, sure, you can also step through in a debugger, but you'll have a
*hard*, *hard* *time* understanding what the compiler did to your code...).

Hope this helps,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160923/a20e4eae/attachment.bin>


More information about the Interest mailing list