Rafael Soares wrote:
Is possible to expose the inst attribute from HelperManager via an accessor to use it on rule's actions (through default Helper)?
Would be nice to use some usefull methods from the Instrumentation impl like the 'getObjectSize(Object objectToSize)'.
Possible, yes. Desirable no. Access to the Instrumentation instance is quite deliberately kept private to Byteman so as to limit the places where Byteman exposes its functionality to i) the Java command line and ii) the agent listener port. In fact HelperManager should not really include this field (it never uses it).
May be a new method in org.jboss.byteman.rule.helper.Helper to wrap the getObjectSize from the Instrumentation.
That's maybe a possibility. Can you tell me why you want it? Better still, if you do want this then you could raise a JIRA on the Byteman project explaining the need for it?
I think it would be better to locate this functionality on Byteman's Rule class though, rather than in the default Helper class. n.b. this would still allow your helper to access the functionality. You can obtain the associated rule for your helper at create time by providing your helper class with a constructor which takes a Rule as argument.
Hi Andrew! Many thanks by reply.
I had needed this to use an another API  that provides a way to get the aproximated size of an object instance. In fact this API was designed to be an javaagent - that's why it uses an Instrument impl.
My case is a quite specific. I wrote a rule  that use the SizeOf API  as a javaagent. I'm thinking on another way to get java object's sizes using an API that isn't a javaagent.