ClassCracker can convert a class file to a jdump Java DUMP file. The jdump file produced allows inspection of the class file structure.
The format of the DUMP follows the specification of class files given in the book:
"The Java Virtual Machine Specification", by Tim Lindholm and Frank Yellin (published by Addison-Wesley)
A code line in the Code Attribute section has the following form:
$absoluteAddress opcode operand1 operand2 ... // comments
Each operand is prefixed by a symbol:
none
- represents a value
#
- represents a constant pool index
*
- represents a local variable index
$
- represents an absolute address
[
- represents the number of array dimensions
(
- represents the number of interface method arguments
:
- represents a constant pool index
::
- represents the default in 'lookupswitch'
>
- represents a constant pool index
<>
- represents the default index in 'tableswitch'
For example:
ldc #7 push item at constant pool index 7
iinc *2 5 increments the local variable at index 2 by 5
iload *4 load 'int' from local variable at index 4
goto $8 execution jumps to absolute address 8
The majority of JVM opcodes are self-explanatory. However there are a few special cases:
a) the 'lookupswitch' opcode has the form:
lookupswitch
:match1 $address1
:match2 $address2
: ... $ ...
:: $addressN // End of Table
where the 'match' corresponds to the value in a case statement, and the corresponding address is the absolute address jumped to if the match is satisfied.
b) the 'tableswitch' opcode has the form:
tableswitch
>index1 $address1
>index2 $address2
> ... $ ...
<> $addressN // End of Table
where the 'index' corresponds to the value in a case statement, and the corresponding address is the absolute address jumped to if the index is satisfied.