This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
java/1413: gdb loses java type information
- From: tromey at redhat dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 8 Oct 2003 18:16:03 -0000
- Subject: java/1413: gdb loses java type information
- Reply-to: tromey at redhat dot com
>Number: 1413
>Category: java
>Synopsis: gdb loses java type information
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 08 18:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Tom Tromey <tromey@redhat.com>
>Release: GNU gdb 2003-10-08-cvs
>Organization:
>Environment:
x86 Red Hat Linux 9
>Description:
Compile this program:
public class foo
{
public static Object doit(Object x)
{
Object y = x;
return y;
}
public static void main(String[] args)
{
doit(args);
}
}
gcj -g --main=foo -o foo foo.java
Then debug with gdb. Run with a few arguments
and step into doit(). Now try to print "y", or
"y[0]":
Breakpoint 1, foo.main(java.lang.String[]) (args=@80760f0) at foo.java:11
Current language: auto; currently java
(gdb) s
foo.doit(java.lang.Object) (x=@80760f0) at foo.java:5
(gdb) n
(gdb) p y
$1 = java.lang.String[]@80760f0
(gdb) p y[0]
cannot subscript something of type `java.lang.Object'
(gdb) p $1[0]
cannot subscript something of type `java.lang.Object'
(gdb) q
In a way it makes sense that "p y[0]" doesn't work,
as y is declared as Object. However, it would be
more convenient if this did work.
However, "p $1[0]" ought to work, and it is weird
that it does not, given that gdb has just reported
that $1 has an array type.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: