Name: rmT116609 Date: 06/17/2003
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Linux durga 2.4.20-1-686-smp #1 SMP Sat Mar 22 13:56:18 EST 2003 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When the target VM is run with -Xcheck:jni, some additional checks are done with native operations(ie getting setting the value of a class' field).
These checks detect a bug in the implementation of JPDA.
It is not possible anymore to get the value of a static field whose type is "Array of Objects".
The Target VM die with message:
FATAL ERROR in native method: Field type (static) mismatch in JNI get/set field operations
This bug is annoying because it becomes impossible to debug code with JNI checks activated !! (eg a Java program that contains native JVMPI/JVMDI code)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
tell jdb to start the target in checked JNI like this:
jdb -Xcheck:jni JPDABug
put a breakpoint anywhere in the code to suspend the execution.
stop at JPDABug:6
ask the value of a static field like this:
dump JPDABug.static1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ObjectReference representing the value of the field of type "Array of Objects"
ACTUAL -
FATAL ERROR in native method: Field type (static) mismatch in JNI get/set field
ERROR MESSAGES/STACK TRACES THAT OCCUR :
com.sun.jdi.VMDisconnectedException
at com.sun.tools.jdi.TargetVM.waitForReply(TargetVM.java:273)
at com.sun.tools.jdi.VirtualMachineImpl.waitForTargetReply(VirtualMachineImpl.java:883)
at com.sun.tools.jdi.PacketStream.waitForReply(PacketStream.java:51)
at com.sun.tools.jdi.JDWP$ReferenceType$GetValues.waitForReply(JDWP.java:2003)
at com.sun.tools.jdi.JDWP$ReferenceType$GetValues.process(JDWP.java:1973)
at com.sun.tools.jdi.ReferenceTypeImpl.getValues(ReferenceTypeImpl.java:547)
at com.sun.tools.jdi.ReferenceTypeImpl.getValue(ReferenceTypeImpl.java:496)
at com.sun.tools.example.debug.expr.LValue$LValueStaticMember.getValue(LValue.java:521)
at com.sun.tools.example.debug.expr.ExpressionParser.evaluate(ExpressionParser.java:59)
at com.sun.tools.example.debug.tty.Commands.evaluate(Commands.java:111)
at com.sun.tools.example.debug.tty.Commands.doPrint(Commands.java:1569)
at com.sun.tools.example.debug.tty.Commands$4.action(Commands.java:1594)
at com.sun.tools.example.debug.tty.Commands$1.run(Commands.java:64)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class JPDABug {
public static Object static1[]={new Object(),new Object()};
public static void main(String[] args) {
// Do something ...
System.out.println("Something done...");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use -Xcheck:jni
But how can we debug efficiently some JNI code after that ?!?
(Review ID: 187529)
======================================================================