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: 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: 08 Oct 2003 16:36:00 -0500

 > 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.
 
 I think you're misinterpreting GDB's behavior here.  y and $1 have
 identical values and types (java.lang.Object).  It's only when GDB
 prints the value that it looks up its dynamic type and uses that in
 the name.  It's not the case that GDB produces a value with the
 dynamic type, but then forgets the type.
 
 If you say "whatis $1", I bet you'll get 'java.lang.Object'.


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