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

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 1 21:05:49 AEDT 2003

On 31-Oct-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> 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.

For Mercury debugging, I agree.  That's why we default to --no-trace-optimized,
and why --trace deep turns off all optimizations that would inhibit debugging
unless --trace-optimized is specified.

But for --target-debug, the argument is much less strong.  If you're
debugging things at the level of the target code, you're already
looking under the hood.  That's why we default to --c-optimize, even if
--target-debug is specified.

I guess for IL it may be a bit different, since we don't support mdb for the
IL back-end yet.

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

I think you meant "... because --no-trace-optimized ...".

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
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