Debugging Layout problems

Doug Way dway at riskmetrics.com
Thu Dec 27 23:19:51 UTC 2001


Ross Boylan wrote:
> 
> I have a bug in some layout code which is bringing up the emergency
> evaluator.  Because of this, I can not bring up an ordinary debugger.
> ...
> 
> Here are some strategies that have occurred to me.  Which horse to bet
> on?
> 
> 1) Debug by inspection.  Unfortunately, I've looked at the code and
> the instance variables, and nothing has jumped out.  I do know where
> the problem is occurring because of the emergency evaluator stack
> trace.
> 
> 2) Put a halt in the code.  But this causes the same loop that brings
> up the emergency evaluator.

In this situation, I usually try the #doOnlyOnce trick with a halt.

Use this code instead where you were trying to put the halt (which
brought up the emergency evaluator):

self doOnlyOnce: [self halt].

This will just do the halt the first time, and then it can proceed
through successfully the following times to open the debugger, etc.  See
ProtoObject>>doOnlyOnce: for more details on how to "re-arm" the
doOnlyOnce mechanism.

Actually, this reminds me that someone posted an improvement awhile back
to reimplement #doOnlyOnce as a method on BlockContext, but I don't
think it had the right subject header to get harvested.  I'll dig that
up and repost it.

- Doug Way
  dway at riskmetrics.com





More information about the Squeak-dev mailing list