|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)|
|Re: Debug optimized code firstname.lastname@example.org (Stephen Horne) (2008-09-22)|
|Re: Debug optimized code email@example.com (George Neuner) (2008-09-23)|
|Was: Debug optimized code; Now: How many compiler bugs have you seen? cfc@shell01.TheWorld.com (Chris F Clark) (2008-09-24)|
|Re: Was: Debug optimized code; Now: How many compiler bugs have you se ArarghMail809@Arargh.com (2008-09-24)|
|Re: Debug optimized code; Now: How many compiler bugs have you seen? firstname.lastname@example.org (Armel) (2008-09-24)|
|[10 later articles]|
|From:||George Neuner <email@example.com>|
|Date:||Sat, 20 Sep 2008 04:28:36 -0400|
|Organization:||A noiseless patient Spider|
|Posted-Date:||20 Sep 2008 23:11:45 EDT|
On 16 Sep 2008 21:37:34 GMT, Stephan Ceram <linuxkaffee_@_gmx.net>
>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?
As you progress through optimization levels, it gets harder to match
assembly with HLL source: not only may different code be generated but
instructions will get reordered and logical code sequences will be
spread out and interleaved. Most compilers create debug info that
tracks everything ok, but many debugger get squirrelly with such code
and jump around crazily in the source when you try to step through
interleaved code. A lot of compilers also don't produce good assembly
listings that make it obvious what source an instruction is associated
If necessary, you can debug successfully at any optimization level.
But if some levels are beyond your comfort zone given your debugging
skills and tools, I would say don't use them.
And please don't debug code at one level and then crank up the
optimization for a production compile. Your ship code should always
be exactly what you've debugged.
Return to the
Search the comp.compilers archives again.