I am trying to write an instrumentation module for Java programs. One particular instrumentation I am looking to add is collecting all the objects in a method's argument list and do some processing on them.
Currently, to get the list of object arguments, I pop all the method args from stack, and then push them in one by one, adding my instrumentation call in between. While this mostly works, I see some
java.lang.VerifyError, [1] (****) Incompatible argument to function
type errors in large programs. Does popping and then pushing an object back to stack change its type somehow? Alternatively, is there a better solution for duplicating 'N' arguments from the stack without popping?