On 23 Nov 2018, at 14:59, Marcus Denker <marcus.denker@inria.fr> wrote:On 23 Nov 2018, at 13:40, Manuel Leuenberger <leuenberger@inf.unibe.ch> wrote:
Hi,
I stumbled upon another MetaLink scenario that I am unsure how to implement. I want to track method invocations, with receiver, arguments, selector, and return value (maybe even signaled exception). I can track the method input with a MetaLink installed on an RBMethodNode like this:
MetaLink new
metaObject: [ :c | Transcript show: c receiver; show: c method selector; show: c arguments; cr ];
selector: #value:;
arguments: #(context).
and for returns with a MetaLink on RBReturnNodes like this:
MetaLink new
metaObject: [ :v | Transcript show: v; cr ];
selector: #value:;
arguments: #(value)
The problem is though, that not all methods have explicit returns, and some mix explicit returns and self returns. I tried installed an #after MetaLink on a RBMethodNode, but this fails in many cases. Is there any way that I can instrument a method and track receiver, selector, arguments, and returned value (even if self) at the same time?
I am working now on making the #after work so that one can get with #value the return of the method���
I now have a version where it works for Message Sends correctly *and* were #after on Method works better (the compilation errors should be fixed).
But #value for #after on Method needs some more work��� soon!
I will commit this intermediate step now.
Marcus