|Debug optimized code linuxkaffee_@_gmx.net (Stephan Ceram) (2008-09-16)|
|Re: Debug optimized code firstname.lastname@example.org (RR) (2008-09-17)|
|Re: Debug optimized code email@example.com (cr88192) (2008-09-17)|
|Re: Debug optimized code firstname.lastname@example.org (Walter Banks) (2008-09-17)|
|Re: Debug optimized code email@example.com (rcmetzger) (2008-09-17)|
|Re: Debug optimized code firstname.lastname@example.org (Stephen Horne) (2008-09-18)|
|Re: Debug optimized code email@example.com (Barry Kelly) (2008-09-19)|
|Re: Debug optimized code firstname.lastname@example.org (George Neuner) (2008-09-20)|
|Re: Debug optimized code DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-09-21)|
|Re: Debug optimized code email@example.com (Stephen Horne) (2008-09-22)|
|[4 later articles]|
|From:||Walter Banks <firstname.lastname@example.org>|
|Date:||Wed, 17 Sep 2008 09:28:14 -0400|
|Posted-Date:||17 Sep 2008 17:55:09 EDT|
Stephan Ceram wrote:
> 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?
This is an incredibly important topic.
Earlier in the week I was talking to a developer about optimization
and it became clear that the reason he wanted optimization off in the
tools he was using was in the tools he was familiar with was so the
source level debugging information reflected the application. In an
example he showed me with higher levels of optimization the compiler
temporarily used a register as a variable but the debugging
information showed the variable as located in the RAM address it was
The developer explained that he debugged the application with their
tools with optimization off and re-compiled and shipped.
This is scary for two reasons, there is an assumption that the
compiled code and application timing will function the same
independent of optimization level. Secondly, code was being shipped
without rigorous testing.
The problem is in the compiler not the source level debugging format.
In the example above there is is no problem describing that a variable
is in a specific register for a specific execution range.
The compiler technology to do this has been available for 15 years or
so. In the last few days this is the third reference to the problem I
A short survey here might help point to what compilers (open source or
commercial) generate source level debugging information that tracks
the optimizations used to generated code.
Byte Craft Limited
Tel. (519) 888-6911
Return to the
Search the comp.compilers archives again.