This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: java/1413: gdb loses java type information
- From: Jim Blandy <jimb at redhat dot com>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 9 Oct 2003 18:58:00 -0000
- Subject: Re: java/1413: gdb loses java type information
- Reply-to: Jim Blandy <jimb at redhat dot com>
The following reply was made to PR java/1413; it has been noted by GNATS.
From: Jim Blandy <jimb@redhat.com>
To: tromey@redhat.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: java/1413: gdb loses java type information
Date: 09 Oct 2003 13:49:05 -0500
Tom Tromey <tromey@redhat.com> writes:
> >> 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.
>
> Jim> I think you're misinterpreting GDB's behavior here. y and $1 have
> Jim> identical values and types (java.lang.Object). It's only when GDB
> Jim> prints the value that it looks up its dynamic type and uses that in
> Jim> the name. It's not the case that GDB produces a value with the
> Jim> dynamic type, but then forgets the type.
>
> Fair enough.
>
> I still think it would be more helpful if gdb let me treat an object
> according to its actual type, as opposed to its declared type. As it
> is, I wind up having to use casts quite a lot, as java containers
> always use Object as the type of the containee.
Are there cases where treating every object according to its dynamic
type would change the semantics of an expression, aside from making
more expressions permissible (while still never accepting non-typesafe
expressions)? If not, then this seems like a pretty natural
extension --- GDB has more information than the compiler does.