-
Bug
-
Resolution: Fixed
-
P2
-
1.0
-
1.0.2
-
sparc
-
generic
-
Not verified
The Java debugger API misinterprets stack values which are arrays.
- It treats them as funny RemoteObjects with zero fields, instead of
RemoteArray objects. That is to say RemoteStackVariable.getValue() will
never return a RemoteArray object.
jdb will show this:
---------------------------------------------------
orbit 67 =>jdb Foo
Initializing jdb...
0xee30c4b8:class(Foo)
> stop in Foo.test
Breakpoint set in Foo.test
> run Foo
Can do magnitude on characters
running ...
main[1]
Breakpoint hit: Foo.test (Foo:5)
main[1] where
[1] Foo.test (Foo:5)
[2] Foo.main (Foo:14)
main[1] up
main[2] locals
Local variables and arguments:
argv = [Ljava.lang.String;@6e300880
aaa = [I@6e30ab78
bbb = [Ljava.lang.Object;@6e30abb0
main[2] dump argv
argv = ([Ljava.lang.String;)0xee300880 {
}
main[2] dump aaa
aaa = ([I)0xee30ab78 {
}
main[2] quit
-------------------------------------------------
Source for Foo.java:
public class Foo {
public static void test (int x, String str, char c) {
System.out.println(str + x + c);
}
public static void main(String[] argv) {
int[] aaa = new int[10];
Object[] bbb = new Object[10];
if ('a' < 'b')
System.out.println("Can do magnitude on characters");
test(1, "Test", 'A');
if (('a' + 'c') < 'b')
System.out.println("Can do addition on characters");
if (('a' >> 2) < 'b')
System.out.println("Can do bit shift on characters");
if ((~'a') < 'b')
System.out.println("Can do bit negation on characters");
if ((bbb[1] == bbb[2]) && (aaa[1] < 10))
System.out.println("Don't optimize away my arrays man!");
};
/* private */ Foo() {}; // private constructor
private int a;
}
- It treats them as funny RemoteObjects with zero fields, instead of
RemoteArray objects. That is to say RemoteStackVariable.getValue() will
never return a RemoteArray object.
jdb will show this:
---------------------------------------------------
orbit 67 =>jdb Foo
Initializing jdb...
0xee30c4b8:class(Foo)
> stop in Foo.test
Breakpoint set in Foo.test
> run Foo
Can do magnitude on characters
running ...
main[1]
Breakpoint hit: Foo.test (Foo:5)
main[1] where
[1] Foo.test (Foo:5)
[2] Foo.main (Foo:14)
main[1] up
main[2] locals
Local variables and arguments:
argv = [Ljava.lang.String;@6e300880
aaa = [I@6e30ab78
bbb = [Ljava.lang.Object;@6e30abb0
main[2] dump argv
argv = ([Ljava.lang.String;)0xee300880 {
}
main[2] dump aaa
aaa = ([I)0xee30ab78 {
}
main[2] quit
-------------------------------------------------
Source for Foo.java:
public class Foo {
public static void test (int x, String str, char c) {
System.out.println(str + x + c);
}
public static void main(String[] argv) {
int[] aaa = new int[10];
Object[] bbb = new Object[10];
if ('a' < 'b')
System.out.println("Can do magnitude on characters");
test(1, "Test", 'A');
if (('a' + 'c') < 'b')
System.out.println("Can do addition on characters");
if (('a' >> 2) < 'b')
System.out.println("Can do bit shift on characters");
if ((~'a') < 'b')
System.out.println("Can do bit negation on characters");
if ((bbb[1] == bbb[2]) && (aaa[1] < 10))
System.out.println("Don't optimize away my arrays man!");
};
/* private */ Foo() {}; // private constructor
private int a;
}