Related articles |
---|
Debug optimized code linuxkaffee_@_gmx.net (Stephan Ceram) (2008-09-16) |
Re: Debug optimized code rajaram.officemails@gmail.com (RR) (2008-09-17) |
Re: Debug optimized code cr88192@hotmail.com (cr88192) (2008-09-17) |
Re: Debug optimized code walter@bytecraft.com (Walter Banks) (2008-09-17) |
Re: Debug optimized code rcmetzger@grandecom.net (rcmetzger) (2008-09-17) |
Re: Debug optimized code sh006d3592@blueyonder.co.uk (Stephen Horne) (2008-09-18) |
Re: Debug optimized code barry.j.kelly@gmail.com (Barry Kelly) (2008-09-19) |
Re: Debug optimized code gneuner2@comcast.net (George Neuner) (2008-09-20) |
Re: Debug optimized code DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-09-21) |
Re: Debug optimized code sh006d3592@blueyonder.co.uk (Stephen Horne) (2008-09-22) |
Re: Debug optimized code gneuner2@comcast.net (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? armelasselin@hotmail.com (Armel) (2008-09-24) |
[10 later articles] |
From: | George Neuner <gneuner2@comcast.net> |
Newsgroups: | comp.compilers |
Date: | Sat, 20 Sep 2008 04:28:36 -0400 |
Organization: | A noiseless patient Spider |
References: | 08-09-076 |
Keywords: | debug, optimize |
Posted-Date: | 20 Sep 2008 23:11:45 EDT |
On 16 Sep 2008 21:37:34 GMT, Stephan Ceram <linuxkaffee_@_gmx.net>
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?
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
with.
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.
George
Return to the
comp.compilers page.
Search the
comp.compilers archives again.