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.
I realize there may be no silver bullets, but does anyone have any suggestions for getting to the bottom of this? I'm in a morphic problem, and the problem is at least a bit subtle because the object displays properly the first time.
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.
3) Put a halt in the code but start it with the mouse off the problem morph, in hopes this will avoid the display loop. It didn't.
4) Learn how to use the emergency evaluator well enough to go up the stack and inspect the instance variables.
5) Do old fashioned debugging with trace statements to a file. Aside from the other problems, I'm not sure if buffering would prevent the interesting stuff from just before the problem from getting out.
I'm currently at 3.2alpha #4441. Many months ago I remember that the system would sometimes display a red box with a yellow X across it in somewhat similar circumstances. If there's a way to get that behavior, that would certainly make debugging easier.
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?
- 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.
- 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@riskmetrics.com
doOnlyOnce is just the kind of magic I was looking for. With that and Bob's tip to look in the debug log I was able to corner the problem and fix it.
Thanks.
At 06:19 PM 12/27/01 -0500, Doug Way wrote:
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@riskmetrics.com
On Wednesday 26 December 2001 10:01 pm, 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.
I realize there may be no silver bullets, but does anyone have any suggestions for getting to the bottom of this? I'm in a morphic problem, and the problem is at least a bit subtle because the object displays properly the first time.
Here are some strategies that have occurred to me. Which horse to bet on?
- Do old fashioned debugging with trace statements to a file. Aside
from the other problems, I'm not sure if buffering would prevent the interesting stuff from just before the problem from getting out.
If you quit from the Emergency Evaluator, I believe that files will be closed and flushed.
Use
Smalltalk snapshot: false andQuit: true
squeak-dev@lists.squeakfoundation.org