Total javassist/bytecode newbie here. I'm writing a program to list bytecode instructions from a classfile, akin to what "javap -c -p CLASSFILE" gives you. Somthing like:
0: aload_0 1: invokespecial #15; //Method java/lang/O 4: aload_0 5: ldc2_w #16; //double 99.0d 8: putfield #19; //Field size:D This snippet from the tutorial lists the index & opcodes but no operands: CodeIterator ci = ... ; while (ci.hasNext()) { int index = ci.next(); int op = ci.byteAt(index); System.out.println(index + ": " +Mnemonic.OPCODE[op]); } Result of this code is something like: 0: aload_0 1: invokespecial <--no operand!!! 4: aload_0 5: ldc2_w <--no operand!!! The "hasNext" call seems to move the iterator to the next opcode, skipping past operands. So how do I parse out operands for things like control flow or method call opcodes? Since # of operands varies based on the particular opcode, is there an easy way to know how many bytes to parse out per instruction? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3937467#3937467 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3937467 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user