public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* gdb -vs- Java strings
@ 2002-04-22 13:53 Tom Tromey
  2002-05-08 12:16 ` Michael Snyder
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2002-04-22 13:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Java Discuss List

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.

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gdb -vs- Java strings
  2002-04-22 13:53 gdb -vs- Java strings Tom Tromey
@ 2002-05-08 12:16 ` Michael Snyder
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Snyder @ 2002-05-08 12:16 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches, Java Discuss List

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-08 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-22 13:53 gdb -vs- Java strings Tom Tromey
2002-05-08 12:16 ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).