Check the validity of a .class file
Mario Mendez-Lojo
marioml at ices.utexas.edu
Thu Nov 20 13:48:20 PST 2008
You are right about the -verify option in the JVM. However, I'm asking about a
tool to *statically* check the validity of a .class file, possibly in the
context of the Hotspot JVM. In this way, I don't need to run the program in
order to figure out if the instrumented bytecode is valid.
It seems to me that verifying the correctness of the bytecode can be done at
compile time, but maybe I'm wrong about this and we can only do the verification
at runtime, within the VM.
Keith McGuigan wrote:
> Mario Mendez-Lojo wrote:
>> Hi guys,
>>
>> I'm manipulating bytecode using the Soot tool. However, sometimes I'll
>> output bytecode that is incorrect (Soot is not able to detect this):
>> local variables declared as of void type, for instance. The
>> transformed, invalid class will make the JVM crash.
>>
>> The question is: is there any tool that can check whether a .class
>> file is in the right format?
>
> Are you running without the JVM's verifier turned on? With the
> verifier, the VM should kick out with a VerifyError or ClassFormatError
> if there's any problem with the classfile format or bytecode. It should
> be on by default, but you can run with 'java -verify' just to be sure.
>
> If the JVM crashes when you feed it a bad classfile, please send the
> classfile to me for diagnosis. This should not happen and would likely
> be a bug in the JVM.
>
> --
> - Keith
More information about the hotspot-dev
mailing list