Question about the debugger

Anthony Hannan ajh18 at cornell.edu
Mon Jul 28 15:57:10 UTC 2003


Hi Stephane,

Stephane Ducasse <ducasse at iam.unibe.ch> wrote:
> Imagine that I have the following script in a workspace
> 
> | caro size |
> caro := Turtle new.
> caro go: size
> 
> Clearly size is nil and somewhere when the message go: will get executed
> I will got an error. The debugger shows up and when I select in the 
> stack the
> UndefinedObject>>doit entry I can see that the variable size is indeed 
> nil.
> Perfect.
> 
> Now when I modify the variable and put 100 for example (which is a 
> correct value
> in our case), and press proceed, the system does not behave as if the 
> variable
> size now holds 100.

This is because the execution proceeds from where it left off, in a
later context, and does not read the size variable in the DoIt context
until execution returns to it.

> Note that the same behavior occurs even if I press on restart then 
> proceed. Size is still nil.

Restart resets to the begining of the method including intializing the
temps to nil.

> It is normal. Why can we modify a variable, change its value and 
> proceed.

You can if you restart first without also proceeding (by turning off
Preferences restartAlsoProceeds), then change your variable value, then
proceed.

Personally, I think restartAlsoProceeds should always be off (not be a
preference).  If you want to restart and proceed just click two buttons
instead of just one.  Then maybe we should rename the "restart" button
to "refresh", "rollback", or "reset".

> I'm in 3.5 but cannot right now test in 3.6. Is this behavior fixed in 
> 3.6 with the new anthony fixes?

There is nothing to fix except turning off or getting rid of the
restartAlsoProceeds preference.

> Another stupid question is that when I evaluate
> 
> |size|
> size + 10
> and proceed, open a debugger, change the variable size to 100 by 
> selecting doit in the stack
> size holds 100 however self does not.

I don't understand?  What is self in this example?

Cheers,
Anthony



More information about the Squeak-dev mailing list