Re: Debug optimized code

Barry Kelly <barry.j.kelly@gmail.com>
Fri, 19 Sep 2008 03:08:59 +0100

          From comp.compilers

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)
Re: Debug optimized code walter@bytecraft.com (Walter Banks) (2008-09-25)
Re: Debug optimized code kamalpr@hp.com (kamal) (2008-10-01)
[1 later articles]
| List of all articles for this month |
From: Barry Kelly <barry.j.kelly@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 19 Sep 2008 03:08:59 +0100
Organization: Compilers Central
References: 08-09-076
Keywords: debug, optimize
Posted-Date: 20 Sep 2008 23:09:12 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?


The Delphi compiler, now (in theory) into its 20th version (but more
like 12th or so after Turbo Pascals and Delphi 1, a different
codebase), has always defaulted to debugging optimized code.


The general philosophy has been (1) don't do optimizations that aren't
always safe, and (2) debug what actually runs on end-users' machines,
not some artificial alternative program.


It's worked well enough up to now. Note, however, that the Delphi
compiler doesn't do huge amounts of optimization beyond constant
folding, a little CSE, inlining, and a some strength reduction.


-- Barry


--
http://barrkel.blogspot.com/



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.