[Pharo-project] Following context execution
Hi I would like to write some tests about MethodContext and BlockClosure activation. To start I wanted to write a simple invocation and step in from context to context. I could manually annotate the code with thisContext and store the resulting contexts somewhere. But does anybody has some magic information so that I can reuse the debugger logic? Stef
In fact I did something really simple like the following. sendSimpleSend "self new sendSimpleSend" ThisContextOne := thisContext. self halt. self simpleSend When I execute the following I do not get why ThisContextOne does not hold a working (pc not nilâ¦.) context. I see a context in the debugger that is fully working. How can I grab a context that is working? Stef On Jan 29, 2012, at 10:25 PM, Stéphane Ducasse wrote:
Hi
I would like to write some tests about MethodContext and BlockClosure activation. To start I wanted to write a simple invocation and step in from context to context.
I could manually annotate the code with thisContext and store the resulting contexts somewhere. But does anybody has some magic information so that I can reuse the debugger logic?
Stef
On Sun, Jan 29, 2012 at 1:25 PM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Hi
I would like to write some tests about MethodContext and BlockClosure activation. To start I wanted to write a simple invocation and step in from context to context.
I could manually annotate the code with thisContext and store the resulting contexts somewhere. But does anybody has some magic information so that I can reuse the debugger logic?
ContextPart>runSimulated:atEachStep:, e.g. | last | last := thisContext. thisContext runSimulated: [#(1 2 3) detect: [:e| e even]] contextAtEachStep: [:c| c ~~ last ifTrue: [Transcript print: c; cr; flush. last := c]] => [] in UndefinedObject>>DoIt Array(Collection)>>detect: Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(Collection)>>detect: [] in UndefinedObject>>DoIt or... | last home indent | last := nil. home := thisContext. indent := 0. thisContext runSimulated: [#(1 2 3) detect: [:e| e even]] contextAtEachStep: [:c| | ctxt | c ~~ last ifTrue: [last := c. indent := 0. ctxt := c sender. [ctxt ~~ home] whileTrue: [ctxt := ctxt sender. indent := indent + 1]. Transcript crtab: indent; print: c; flush]] [] in UndefinedObject>>DoIt Array(Collection)>>detect: Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(Collection)>>detect: [] in UndefinedObject>>DoIt -- best, Eliot
Thanks I will definitively play with that. On Jan 31, 2012, at 12:28 AM, Eliot Miranda wrote:
On Sun, Jan 29, 2012 at 1:25 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Hi
I would like to write some tests about MethodContext and BlockClosure activation. To start I wanted to write a simple invocation and step in from context to context.
I could manually annotate the code with thisContext and store the resulting contexts somewhere. But does anybody has some magic information so that I can reuse the debugger logic?
ContextPart>runSimulated:atEachStep:, e.g.
| last | last := thisContext. thisContext runSimulated: [#(1 2 3) detect: [:e| e even]] contextAtEachStep: [:c| c ~~ last ifTrue: [Transcript print: c; cr; flush. last := c]]
=>
[] in UndefinedObject>>DoIt Array(Collection)>>detect: Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(Collection)>>detect: [] in UndefinedObject>>DoIt
or...
| last home indent | last := nil. home := thisContext. indent := 0. thisContext runSimulated: [#(1 2 3) detect: [:e| e even]] contextAtEachStep: [:c| | ctxt | c ~~ last ifTrue: [last := c. indent := 0. ctxt := c sender. [ctxt ~~ home] whileTrue: [ctxt := ctxt sender. indent := indent + 1]. Transcript crtab: indent; print: c; flush]]
[] in UndefinedObject>>DoIt Array(Collection)>>detect: Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(SequenceableCollection)>>do: [] in Array(Collection)>>detect:ifNone: [] in [] in UndefinedObject>>DoIt SmallInteger>>even [] in [] in UndefinedObject>>DoIt [] in Array(Collection)>>detect:ifNone: Array(Collection)>>detect: [] in UndefinedObject>>DoIt
-- best, Eliot
participants (2)
-
Eliot Miranda -
Stéphane Ducasse