* [commit] Minor java fixups
@ 2007-05-14 16:49 Daniel Jacobowitz
2007-05-14 19:54 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-05-14 16:49 UTC (permalink / raw)
To: gdb-patches
Debian's gcj package is now very close to GCC HEAD; this turned up new
problems in the testsuite. I've fixed the ones which could be readily
fixed in GDB, as below:
- GCJ is now stricter about calling a static method via an object.
- "set debug exp 1" caused a crash in java_print_type dereferencing
NULL.
- STRUCTOP_STRUCT (used to call a member function of an object) is
wrong for Java; we need STRUCTOP_PTR because the "object" is always
a pointer to an object. This was harmless before but the new GCJ
puts the pointer in a register, even at -O0.
I also filed GCC PR 31920 and added information to another PR about
problems I found in the debug output.
GDB's Java support is getting very rusty. I think it's been several
releases since it was able to print objects, and it's even worse now
that we only get a declaration for java.lang.Object in the debug info.
It really needs some tender care from someone who uses gcj.
I've tested this patch on x86_64-linux and checked it in.
--
Daniel Jacobowitz
CodeSourcery
2007-05-14 Daniel Jacobowitz <dan@codesourcery.com>
* jv-exp.y (push_fieldnames): Use STRUCTOP_PTR instead of
STRUCTOP_STRUCT.
* jv-lang.c (evaluate_subexp_java): Handle STRUCTOP_PTR instead of
STRUCTOP_STRUCT.
* jv-typeprint.c (java_print_type): Do not crash on NULL varstring.
* gdb.java/jprint.java (public): Avoid invalid call to static
method.
Index: jv-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/jv-exp.y,v
retrieving revision 1.24
diff -u -p -r1.24 jv-exp.y
--- jv-exp.y 9 Jan 2007 17:58:51 -0000 1.24
+++ jv-exp.y 14 May 2007 16:24:32 -0000
@@ -1265,7 +1265,7 @@ push_variable (struct stoken name)
}
/* Assuming a reference expression has been pushed, emit the
- STRUCTOP_STRUCT ops to access the field named NAME. If NAME is a
+ STRUCTOP_PTR ops to access the field named NAME. If NAME is a
qualified name (has '.'), generate a field access for each part. */
static void
@@ -1281,9 +1281,9 @@ push_fieldnames (name)
{
/* token.ptr is start of current field name. */
token.length = &name.ptr[i] - token.ptr;
- write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_elt_opcode (STRUCTOP_PTR);
write_exp_string (token);
- write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_elt_opcode (STRUCTOP_PTR);
token.ptr += token.length + 1;
}
if (i >= name.length)
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.45
diff -u -p -r1.45 jv-lang.c
--- jv-lang.c 9 Jan 2007 17:58:51 -0000 1.45
+++ jv-lang.c 14 May 2007 16:24:32 -0000
@@ -928,7 +928,7 @@ evaluate_subexp_java (struct type *expec
goto nosideret;
return java_value_string (&exp->elts[pc + 2].string, i);
- case STRUCTOP_STRUCT:
+ case STRUCTOP_PTR:
arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
/* Convert object field (such as TYPE.class) to reference. */
if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_STRUCT)
Index: jv-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-typeprint.c,v
retrieving revision 1.11
diff -u -p -r1.11 jv-typeprint.c
--- jv-typeprint.c 9 Jan 2007 17:58:51 -0000 1.11
+++ jv-typeprint.c 14 May 2007 16:24:32 -0000
@@ -338,6 +338,6 @@ java_print_type (struct type *type, char
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s */
- demangled_args = strchr (varstring, '(') != NULL;
+ demangled_args = varstring != NULL && strchr (varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
}
Index: testsuite/gdb.java/jprint.java
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jprint.java,v
retrieving revision 1.1
diff -u -p -r1.1 jprint.java
--- testsuite/gdb.java/jprint.java 20 Sep 2004 20:06:29 -0000 1.1
+++ testsuite/gdb.java/jprint.java 14 May 2007 16:26:24 -0000
@@ -54,7 +54,7 @@ public class jprint extends jvclass {
}
public static void main(String[] args) {
jprint x = new jprint ();
- x.print (44);
+ x.dothat (44);
print (k, 33);
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [commit] Minor java fixups
2007-05-14 16:49 [commit] Minor java fixups Daniel Jacobowitz
@ 2007-05-14 19:54 ` Tom Tromey
2007-05-14 20:02 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2007-05-14 19:54 UTC (permalink / raw)
To: gdb-patches
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> GDB's Java support is getting very rusty. I think it's been several
Daniel> releases since it was able to print objects, and it's even worse now
Daniel> that we only get a declaration for java.lang.Object in the debug info.
FWIW most gcj developers now use the runtime debugging support
functions that Andrew wrote -- _Jv_Debug and friends. These generally
seem more reliable than gdb's "print" ever was. (Not that this is
necessarily gdb's fault. It is just that few people have ever
ventured into this area to find and fix bugs.)
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [commit] Minor java fixups
2007-05-14 19:54 ` Tom Tromey
@ 2007-05-14 20:02 ` Daniel Jacobowitz
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-05-14 20:02 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Mon, May 14, 2007 at 01:35:26PM -0600, Tom Tromey wrote:
> >>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
>
> Daniel> GDB's Java support is getting very rusty. I think it's been several
> Daniel> releases since it was able to print objects, and it's even worse now
> Daniel> that we only get a declaration for java.lang.Object in the debug info.
>
> FWIW most gcj developers now use the runtime debugging support
> functions that Andrew wrote -- _Jv_Debug and friends. These generally
> seem more reliable than gdb's "print" ever was. (Not that this is
> necessarily gdb's fault. It is just that few people have ever
> ventured into this area to find and fix bugs.)
It's the "fault" of the nebulous non-developer who is working on
GDB's Java support :-) I'd be delighted if someone stepped up
and was interested.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-14 20:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-14 16:49 [commit] Minor java fixups Daniel Jacobowitz
2007-05-14 19:54 ` Tom Tromey
2007-05-14 20:02 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox