Question about the debugger

Stephane Ducasse ducasse at iam.unibe.ch
Mon Jul 28 20:01:18 UTC 2003


On Monday, July 28, 2003, at 05:57 PM, Anthony Hannan wrote:

> 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.

What would be good is to have a "proceed" or restart that would take 
into account
the change done to the variable in the environment or instance 
variables.
Because now if you change a variable in fact you can select an 
expression and the
expression will access the changed value but if you proceed this will 
not.

So I thought this could be confusing for new guys. This is only because 
I play
naively with the debugger that I noticed this kind of "not so good" 
behavior.


>> 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?

What I wanted to say is that if you take this example: self and size 
will be both nil
then when you change the value of size using accept. the value of self 
will not be
changed but this is normal because self was then representing an 
undefinedObject
and we cannot imagine that changing the value of size woudl change the 
execution context.
This was silly (I worked 9 hours in a train so I should have stopped 
:)).





More information about the Squeak-dev mailing list