instrumentation on anonymous class.

Zhongxian Gu <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi,

I encountered some problems when instrument the byte code of some anonymous
classes. The scenario is like the following,

in a function call, if it is not a static function, I want to record the
receiver of this function call, which usually be local variable 0.

So my code is like the following:

mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "identityHashCode",
"(Ljava/lang/Object;)I");
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf",
"(I)Ljava/lang/Integer;");
mv.visitMethodInsn(INVOKESTATIC, "OutputWrapper", "writeToFile",
"(Ljava/lang/Object;)V");

Is there any problem with this?

I got the following exception: Exception in thread "main"
java.lang.VerifyError: (class: Test$1, method: <init> signature: (I)V)
Expecting to find object/array on stack

Thank you guys.

Best

Zhongxian
-- 
Zhongxian Gu
http://wwwcsif.cs.ucdavis.edu/~gu/
Ph.D. Student in Computer Science, UC Davis
2249 Kemper Hall
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.