This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java/1413: gdb loses java type information


The following reply was made to PR java/1413; it has been noted by GNATS.

From: Daniel Jacobowitz <drow@mvista.com>
To: Tom Tromey <tromey@redhat.com>, gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: java/1413: gdb loses java type information
Date: Wed, 8 Oct 2003 22:17:36 -0400

 On Wed, Oct 08, 2003 at 10:28:00PM -0000, Tom Tromey wrote:
 > The following reply was made to PR java/1413; it has been noted by GNATS.
 > 
 > From: Tom Tromey <tromey@redhat.com>
 > To: Jim Blandy <jimb@redhat.com>
 > Cc: gdb-gnats@sources.redhat.com
 > Subject: Re: java/1413: gdb loses java type information
 > Date: 08 Oct 2003 16:19:30 -0600
 > 
 >  >> 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.
 
 What would Java do here?  Could you subscript an object whose actual
 type was an array type and whose declared type was Object, or would you
 need to cast/assign it first?
 
 -- 
 Daniel Jacobowitz
 MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]