gcc build with -O0 results in corrupted -debuginfo package
kevin.kofler at chello.at
Fri Apr 25 16:10:56 UTC 2014
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. GDB can cope quite
well with it, and it is the only way to actually debug the real code that
gets executed. -O0 makes the code very different from production code, e.g.,
you can get away with more abuse of undefined behavior (and thus, if that
was the cause of the crashes, you won't find them when debugging under -O0).
Often, broken code only actually breaks under optimized compilation. This is
all the more the case for issues triggered by an updated GCC. Even in those
rare cases where the bug really is in GCC, it is often in an optimization
pass and thus won't happen under -O0 either.
More information about the devel