[ENH] Enhanced Debugging Experience (first shot)

Doug Way dway at riskmetrics.com
Sat Jul 21 04:36:36 UTC 2001


On Friday, July 20, 2001, at 09:03 AM, Hans-Martin Mosner wrote:

> Doug Way wrote:
>> One other nice thing to fix at some point would be the PC highlighting 
>> for NonBoolean receiver errors. For example, if you Do this in a 
>> workspace:
>>
>> nil ifTrue: [x _ 'asdfas' asSortedCollection].
>>
>> The NonBoolean receiver debugger comes up, but the #asSortedCollection 
>> method is currently highlighted, when it seems that #ifTrue: should be 
>> highlighted instead.
>
> I've looked into it, but the matter is a little complicated.
> The pc of the context causing the #mustBeBoolean exception is 
> positioned just after the jump-if-false bytecode. Therefore, the line 
> in the notification 'proceed for truth' magically works, because the 
> #mustBeBoolean context returns to this place.
> However, to distinguish this situation from a normal message send, the 
> debugger would have to look at more than the selected context, which 
> would make things more complicated and possibly unstable.

I had a feeling this wouldn't be a simple fix... ah well.

> There's another tricky matter here which makes the #mustBeBoolean 
> handling inherently dangerous:
> ...

> In my opinion, the handling of non-boolean conditions in the VM should 
> be handled such that the PC is left in front of the jump instruction. 
> Then the returned value would be consumed by the jump, and everything 
> would be fine. You could then even proceed with a value of false if 
> that seems more appropriate.

That would be great.  I guess there'd be a bit of work on both the VM 
side and image side, though.

> Of course, all of this is probably rather irrelevant, because the first 
> thing you would do when you stumble across such a case is to fix the 
> underlying bug which causes the receiver of ifTrue:ifFalse: to be a 
> non-boolean in the first place...

I wouldn't go quite that far.  It's actually pretty confusing for a 
beginner to deal with the debugger in this state... it appears to be 
telling you that an unrelated object is supposed to be a boolean.  
Sometimes the next PC highlighted selector is a ways after the offending 
boolean, throwing one off the trail further.  (And there's an 
expectation among beginners that the debugger highlighting is 
accurate... especially if you include your improvements. :-) )

- Doug Way
   dway at riskmetrics.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2558 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20010721/252cf6b1/attachment.bin


More information about the Squeak-dev mailing list