[m-rev.] for review: improve debugging support for il grade.

Peter Ross pro at missioncriticalit.com
Sat Nov 1 00:20:40 AEDT 2003


On Wed, Oct 29, 2003 at 10:01:17AM +1100, Fergus Henderson wrote:
> On 28-Oct-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > Improve the support for debugging in the il grade, by not optimizing
> > the generated il code, unless needed for verifiability.
> > 
> > Using
> > 	mmc --make --grade il --target-debug -O0 diff
> > now generates code which is relatively easier to debug in an IL
> > debugger.
> 
> This is a good idea, but whether or not the generated IL code is
> peephole optimized should depend on the "-O" setting, not on whether
> or not --target-debug is specified.  Otherwise there's too much danger
> of Heisenbugs (bugs which go away when you enabled debugging).
> 
> Currently peephole optimization is enabled at "-O0".
> I'd be happy to change that so that it was instead enabled at "-O1"
> for the IL back-end if and only if this speeds up compilation at "-O0".
> 
> Otherwise, I'd say use "--target-debug -O-1" or
> "--target-debug -O0 --no-optimize-peep" if you want
> the IL code to be maximally easy to debug.
> If that is too complicated, we could consider introducing
> a new option (perhaps "--opt-debug", by analogy with to "--opt-space"?),
> which disabled optimizations that inhibit debugging.
> 
IMHO when compiling Mercury with debugging turned on at the default
optimization level, one should have a reasonable debugging experience.

What is a reasonable debugging experience?

For me it is 
    * the ability to examine all the declared variables in a line of code
    * pressing next or step-in does something reasonable.

Currently this is not true, because the peephole optimizer removes
references to the variable names and the inliner, I believe,  brings in
lots of code (from external modules) where the source lines aren't
available.

The optimization levels of the Mercury compiler should be rearranged to
achieve this goal in my opinion.

Note that we already have the ability for Heisenbugs in the current
compilation schema because --trace-optimize is automatically enabled.

What are other peoples thoughts about this issue?
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list