Fetching arguments

A set of functions has been defined to create spy probes that will can be injected into instrumented methods. All probes have key parameter that is used to store obtained values in fetch probes and some functions have additiona parameters.

Argument fetching plugins are the only ones that result in additional bytecode injected into instrumented methods. Remaining plugins are executed as parts of processing chain that is called at predefined parts of instrumented methods.


spy.fetchArg(key, num)

Fetches num-th method argument. For instance method visible arguments start with 1 and argument number 0 contains reference to object instance on behalf of which method has been called (this). For static methods arguments start with 0. Note that when instrumenting constructors, fetching reference to this is illegal at the beginning of constructor. You have to to this at return point of constructor.


spy.fetchClass(key, name)

Fetches class named name in the context of instrumented method (that is, with class loader of its parent class). Returns java.lang.Class object.



Fetches exception thrown out of method. This can be used only in error handling path (.onError(...)) of spy def.



Fetches return value of a method. This can be used only at return points (.onReturn(...)) of spy def.



Fetches thread executing method code. Returns java.lang.Thread object.



Fetches current time (System.nanoTime() result - nanoseconds since Epoch).