This is the mail archive of the gdb-patches@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: gdb -vs- Java strings


Tom Tromey wrote:
> 
> At some point gdb stopped being able to print String values for Java
> String objects.
> 
> Today I really needed to be able to print a String while doing some
> last-minute debugging for the gcc 3.1 release, so I debugged gdb a
> bit.
> 
> It turns out that on the object in question, TYPE_NAME on the target
> type is not set.  However, and contrary to what I would expect given
> the comments in gdbtypes.h, TYPE_TAG_NAME was set to
> "java.lang.String".
> 
> Hence this hacky patch, which lets me continue with my priority work
> right now.
> 
> If someone can tell me a better way to fix this, I'll file it away for
> when I have time to fix the problem for real.  Otherwise, maybe other
> Java folks will find this useful.
> 
> I'm using the current cvs trunk gdb.

Hmmm...
I'd be interested in knowing why it changed (was this a compiler
change?), 
and whether it was ever likely to change back.

Not knowing that, I would be inclined to leave both tests
(the old and the new) in place.


> 
> Tom
> 
> Index: jv-valprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/jv-valprint.c,v
> retrieving revision 1.9
> diff -u -r1.9 jv-valprint.c
> --- jv-valprint.c 21 Oct 2001 01:57:42 -0000 1.9
> +++ jv-valprint.c 22 Apr 2002 19:37:56 -0000
> @@ -198,8 +198,9 @@
> 
>    if (TYPE_CODE (type) == TYPE_CODE_PTR
>        && TYPE_TARGET_TYPE (type)
> -      && TYPE_NAME (TYPE_TARGET_TYPE (type))
> -      && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
> +      && TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
> +      && strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
> +                "java.lang.String") == 0
>        && (format == 0 || format == 's')
>        && address != 0
>        && value_as_address (val) != 0)


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