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

Peter Ross pro at missioncriticalit.com
Sat Nov 1 22:50:49 AEDT 2003


On Sat, Nov 01, 2003 at 09:05:49PM +1100, Fergus Henderson wrote:
> 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.
> 
I understand what you mean.

This is what I believe should change.

--debug should be allowed on the il backend.

When --debug is enabled it implies --trace-debug.

--no-trace-optimized should turn off --il-peephole-optimize.

The peephole optimization phase should look at --verifiable-code and
--il-peephole-optimization when deciding what type of peephole
optimization to do.

This I believe would satisfy us all.

> > 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 ...".
> 
Yes I did.

-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
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