-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
beta2
-
generic
-
generic
-
Verified
Name: ipR10196 Date: 02/27/2004
-----------------------------------------------------
Test : nsk/sajdi/ArrayReference/getValues/getvalues001
VM : ClientVM, ServerVM
Mode : all
Platform : generic
OS : generic
JDK : 1.5.0-beta2-b40 and earlier
------------------------------------------------------
This SA-JDI test checks if getValues() returns expected values
of arrrays of various kinds, including primitive arrays,
object arrays and arrays of arrays.
Running with legacy JDI connectors this test passes.
Running with SA-JDI connectors this test reveals three
main problems with these functions.
1. Getting values of long[] and double[] arrays:
static long[] primArrLong = {7654321L, -6745328L, 0L, 1L};
static double[] primArrDouble = {1.0e-8, -3.14e+3, 0.0, 4.567, -0.007e-5};
On 32-bit Solaris/sparc platform getValues() throws UnalignedAddressException:
field #5
field name: primArrLong
signature: [J
... found expected field #5
ArrayReference: instance of long[4] (id=6)
sun.jvm.hotspot.debugger.UnalignedAddressException:
Trying to read at address: 0xf0442d4c with alignment: 8
at sun.jvm.hotspot.debugger.DebuggerUtilities.checkAlignment(DebuggerUtilities.java:40)
at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.readJLong(ProcDebuggerLocal.java:274)
at sun.jvm.hotspot.debugger.proc.ProcAddress.getJLongAt(ProcAddress.java:87)
at sun.jvm.hotspot.oops.TypeArray.getLongAt(TypeArray.java:68)
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:125)
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:51)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkArrayValue(getvalues001.java:500)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkFieldValue(getvalues001.java:486)
at nsk.sajdi.ArrayReference.getValues.getvalues001.runIt(getvalues001.java:388)
at nsk.sajdi.ArrayReference.getValues.getvalues001.run(getvalues001.java:26)
at nsk.sajdi.ArrayReference.getValues.getvalues001.main(getvalues001.java:21)
# ERROR: ArrayReference.getValues() throws unexpected exception:
# ERROR: field name: primArrLong
# ERROR: signature: [J
# ERROR: array obj: instance of long[4] (id=6)
# ERROR: exception: sun.jvm.hotspot.debugger.UnalignedAddressException:
Trying to read at address: 0xf0442d4c with alignment: 8
field #7
field name: primArrDouble
signature: [D
... found expected field #7
ArrayReference: instance of double[5] (id=8)
sun.jvm.hotspot.debugger.UnalignedAddressException:
Trying to read at address: 0xf0442d9c with alignment: 8
at sun.jvm.hotspot.debugger.DebuggerUtilities.checkAlignment(DebuggerUtilities.java:40)
at sun.jvm.hotspot.debugger.DebuggerBase.readJDouble(DebuggerBase.java:250)
at sun.jvm.hotspot.debugger.proc.ProcAddress.getJDoubleAt(ProcAddress.java:75)
at sun.jvm.hotspot.oops.TypeArray.getDoubleAt(TypeArray.java:78)
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:113)
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:51)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkArrayValue(getvalues001.java:500)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkFieldValue(getvalues001.java:486)
at nsk.sajdi.ArrayReference.getValues.getvalues001.runIt(getvalues001.java:388)
at nsk.sajdi.ArrayReference.getValues.getvalues001.run(getvalues001.java:26)
at nsk.sajdi.ArrayReference.getValues.getvalues001.main(getvalues001.java:21)
# ERROR: ArrayReference.getValues() throws unexpected exception:
# ERROR: field name: primArrDouble
# ERROR: signature: [D
# ERROR: array obj: instance of double[5] (id=8)
# ERROR: exception: sun.jvm.hotspot.debugger.UnalignedAddressException:
Trying to read at address: 0xf0442d9c with alignment: 8
On 32-bit Linux platform GetValues() does not thrown exception,
but returns wrong values of long and double types:
# ERROR: ArrayReference.getValues() returned unexpected LongValue value:
# ERROR: field name: primArrLong
# ERROR: signature: [J
# ERROR: array obj: instance of long[4] (id=6)
# ERROR: list size: 4
# ERROR: list index: 0
# ERROR: got value: 32875058368086016
# ERROR: expected: (long)7654321
# ERROR: ArrayReference.getValues() returned unexpected DoubleValue value:
# ERROR: field name: primArrDouble
# ERROR: signature: [D
# ERROR: array obj: instance of double[5] (id=8)
# ERROR: list size: 5
# ERROR: list index: 0
# ERROR: got value: -9.529209059420778E164
# ERROR: expected: (double)1.0E-8
On 32-bit Solaris/x86 platform GetValues() throws UnalignedAddressException
for double values and returns wrong long values:
# ERROR: ArrayReference.getValues() returned unexpected LongValue value:
# ERROR: field name: primArrLong
# ERROR: signature: [J
# ERROR: array obj: instance of long[4] (id=6)
# ERROR: list size: 4
# ERROR: list index: 0
# ERROR: got value: 32875058368086016
# ERROR: expected: (long)7654321
# ERROR: ArrayReference.getValues() throws unexpected exception:
# ERROR: field name: primArrDouble
# ERROR: signature: [D
# ERROR: array obj: instance of double[5] (id=8)
# ERROR: exception: sun.jvm.hotspot.debugger.UnalignedAddressException:
Trying to read at address: 0xd14455fc with alignment: 8
On 64-bit Solaris/sparcv9 platform both long and double value
are returned correctly.
2. Getting values of string array being result of String.split():
static String[] objArrString = new String[]
{"foo", "plain/text", "some * str.ange? string!", null};
static String[] objArrString2 =
"some! split/string value-0123 ...".split(" ");
Values of first string array 'objArrString' are returned correctly,
while values of second array 'objArrString2' are returned incorrectly
(except first element). This happens on all platforms:
field #10
field name: objArrString2
signature: [Ljava/lang/String;
... found expected field #10
ArrayReference: instance of java.lang.String[4] (id=11)
length: 4
item #0
value: "some!"
equal: true
item #1
value: "split/"
equal: false
# ERROR: ArrayReference.getValues() returned unexpected StringReference value:
# ERROR: field name: objArrString2
# ERROR: signature: [Ljava/lang/String;
# ERROR: array obj: instance of java.lang.String[4] (id=11)
# ERROR: list size: 4
# ERROR: list index: 1
# ERROR: got value: "split/"
# ERROR: expected: (String)split/string
item #2
value: ""
equal: false
# ERROR: ArrayReference.getValues() returned unexpected StringReference value:
# ERROR: field name: objArrString2
# ERROR: signature: [Ljava/lang/String;
# ERROR: array obj: instance of java.lang.String[4] (id=11)
# ERROR: list size: 4
# ERROR: list index: 2
# ERROR: got value: ""
# ERROR: expected: (String)value-0123
item #3
value: ""
equal: false
# ERROR: ArrayReference.getValues() returned unexpected StringReference value:
# ERROR: field name: objArrString2
# ERROR: signature: [Ljava/lang/String;
# ERROR: array obj: instance of java.lang.String[4] (id=11)
# ERROR: list size: 4
# ERROR: list index: 3
# ERROR: got value: ""
# ERROR: expected: (String)...
3. Getting value of special kind of object array that contains
references to other arrays:
static Object[] arrGenArrObject = new Object[] {objArrObject, arrObjArrString, null};
where:
static Object[] objArrObject = new Object[] {"a string object", null};
static String[][] arrObjArrString = {objArrString, objArrString2, null};
On all platforms GetValues() throws ClassCastException:
field #21
field name: arrGenArrObject
signature: [Ljava/lang/Object;
... found expected field #21
ArrayReference: instance of java.lang.Object[3] (id=22)
java.lang.ClassCastException: sun.jvm.hotspot.oops.ObjArray
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:128)
at sun.jvm.hotspot.jdi.ArrayReferenceImpl.getValues(ArrayReferenceImpl.java:51)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkArrayValue(getvalues001.java:500)
at nsk.sajdi.ArrayReference.getValues.getvalues001.checkFieldValue(getvalues001.java:486)
at nsk.sajdi.ArrayReference.getValues.getvalues001.runIt(getvalues001.java:388)
at nsk.sajdi.ArrayReference.getValues.getvalues001.run(getvalues001.java:26)
at nsk.sajdi.ArrayReference.getValues.getvalues001.main(getvalues001.java:21)
# ERROR: ArrayReference.getValues() throws unexpected exception:
# ERROR: field name: arrGenArrObject
# ERROR: signature: [Ljava/lang/Object;
# ERROR: array obj: instance of java.lang.Object[3] (id=22)
# ERROR: exception: java.lang.ClassCastException: sun.jvm.hotspot.oops.ObjArray
Substituting GetValues() with GetValues(0,-1) produces the same failures.
To reproduce all these failures:
cd /net/jano.sfbay/export/disk20/GammaBase/Bugs/<this bug number>
sh build.sh $JAVA_HOME
sh run.sh [-pid | -core | -socket] [-g] [-v] $JAVA_HOME [JAVA_OPTS]
where:
-pid - run test with SA-JDI pid attaching connector (default)
-core - run test with SA-JDI core attaching connector
-socket - run test with JDI socket attaching connector
-g - run test with java_g binaries
-v - run test in verbose mode
This test will appear in the next r27 testbase release.
Running on Linux this test may fail due to known bug:
4996081 SA-JDI: SAPIDAttachingConnector.attach() throws IOEception on RH AS2.1
======================================================================
Name: ipR10196 Date: 02/28/2004
This bug also affects the following test for GetValues(int,int):
nsk/sajdi/ArrayReference/getValues_ii/getvalues_ii001
It also affects test for PathSearchingVirtualMachine.classPath(),
because this test uses String.split() to split classpath
into array of strings and then compares these strings with
results of calssPath() call. Thus it suffers from problem 2 mentioned
above. This is the following test:
nsk/sajdi/PathSearchingVirtualMachine/classPath/classpath001
======================================================================