Hi all,

As I'm playing with the debugger I thought I'll share with you a nice
feature the current model supports: scripting the actions

In the current version the following code is a rather complicated
way of opening a debugger for the code �'#(1 2 3 4 5) do: [:each | each asString ]'

[ � � ��|process|
� � � � process := Processor activeProcess.
UIManager default defer: [ |debugger session|
session := SpecDebugger spanNewSessionForProcess: process. "create the model"
session errorWasInUIProcess: false.

� � � � � � � ��debugger := SpecDebugger debugSession: session. "open the debugger"].
� � � ��process suspend.

� � � � "The previous lines open a debugger for this code"
� � � � #(1 2 3 4 5) do: [:each | each asString ]
] fork.

However, the nice thing about the code above is that as the model is completely
separated from the ui, the model can be used to script some actions (stepInto, stepThrough, etc)
before or after opening the debugger. So in the code bellow using one of the two
commented blocks of code, one execute some actions before or after opening the debugger.

[ � � ��|process|
� � � � process := Processor activeProcess.
UIManager default defer: [ |debugger session|
session := SpecDebugger spanNewSessionForProcess: process. "create the model"
session errorWasInUIProcess: false.

� � � � � � � � "session�
stepInto;
stepThrough;
stepThrough;
stepThrough;
stepThrough;
stepOver;
stepInto."

� � � � � � � ��debugger := SpecDebugger debugSession: session. "open the debugger"

� � � � � � � � "debugger session�
confirm: 'Step Into';
stepInto;
confirm: '4 * Step Through';
stepThrough;
stepThrough;
stepThrough;
stepThrough;
confirm: 'Step Over';
stepOver;
confirm: 'Step Into';
stepInto." ].
� � � ��process suspend.

� � � � "The previous lines open a debugger for this code"
� � � � #(1 2 3 4 5) do: [:each | each asString ]
] fork.

Also the same model can be used with multiple ui's or the same ui can be reused with different models.
Right now this works in Pharo 2.0, but there isn't a configuration for loading it; if someone really wants to
try it I can provide instructions of how to load the code.

Cheers,
Andrei