|Debug optimized code linuxkaffee_@_gmx.net (Stephan Ceram) (2008-09-16)|
|Re: Debug optimized code email@example.com (RR) (2008-09-17)|
|Re: Debug optimized code firstname.lastname@example.org (cr88192) (2008-09-17)|
|Re: Debug optimized code email@example.com (Walter Banks) (2008-09-17)|
|Re: Debug optimized code firstname.lastname@example.org (rcmetzger) (2008-09-17)|
|Re: Debug optimized code email@example.com (Stephen Horne) (2008-09-18)|
|Re: Debug optimized code firstname.lastname@example.org (Barry Kelly) (2008-09-19)|
|Re: Debug optimized code email@example.com (George Neuner) (2008-09-20)|
|Re: Debug optimized code DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-09-21)|
|[5 later articles]|
|Date:||Wed, 17 Sep 2008 22:12:44 +1000|
|Posted-Date:||17 Sep 2008 17:53:54 EDT|
"Stephan Ceram" <linuxkaffee_@_gmx.net> wrote in message
> I've a question about compilers' symbolic debugging information (like
> DWARF2) and compiler optimizations. Should the code be always compiled
> without any optimizations, i.e. -O0, to get accurate debug information
> where all source code line number are correct or would I also get accurate
> results for higher optimization levels? Usually, at least -O1 does
> not modify the code too much, so I would assume that this optimization
> level could be applied for a successful debugging afterwards.
> What are you experiences?
Well, in general, if one is using debugging, they don't want any
optimization, and if they want optimization, they can't really use
One can try, but the usual experience is that of the debugger not
giving very good results. however, what exactly happens is likely to
depend very much on the specific compiler and version.
Now, usually one does not give any '-O' options, instead they may give
'-g' or '-pg' (profiling), and leave it up to the compiler to set up
any optimizations (even '-O0' may possibly do something weird, or by
default the compiler may leave on some optimizations which do not
effect debugging, with '-O0' forcing it to not even use these, ...).
[I debug optimized code all the time, when the "final" version of something
turns out to have a few more bugs. -John]
Return to the
Search the comp.compilers archives again.