Re: gcc build with -O0 results in corrupted -debuginfo package

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/04/14 20:10, Simo Sorce wrote:
On Fri, 2014-04-25 at 14:03 -0400, Adam Jackson wrote:
On Fri, 2014-04-25 at 18:10 +0200, Kevin Kofler wrote:
Petr Spacek wrote:
I'm going to reproduce and debug issue in named. Do you see any specific
reason why I should use -O2 for serious debugging/development sessions?

IMHO, you should always debug with optimization enabled.

s/debug/test/ IMHO.

Kevin, have you ever debugged with -O2 ?

It's more than reasonable to want -O0.
At -O2 some code becomes really annoying to follow because gcc will
optimize away way too much of it into registers (and gdb will not print
you the values you need to see) or will make stepping a nightmare with
gdb jumping in an out of the function as it gets inlined and then some
stuff moved "out of the original function" and things like that.

I've been more than once in gdb with -O2, it is *not* pretty, nor
useful.

+1

debug symbols at -O2 are mostly useful to get backtraces, but if you
need to really step through with gdb in some complicated, highly
optimizable code, often it does not cut it, you have to rebuild with -O0
to regain debuggability and sanity.

-Og (new in gcc 4.8) is meant to enable only optimizations which won't confuse gdb but I've not found a need to optimize my code just a little bit while debugging yet, so -O0 is still my --enable-debug flag.

Andy
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux