This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
gdb -vs- Java strings
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: Java Discuss List <java at gcc dot gnu dot org>
- Date: 22 Apr 2002 13:48:20 -0600
- Subject: gdb -vs- Java strings
- Reply-to: tromey at redhat dot com
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)