Index: c-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-typeprint.c,v retrieving revision 1.54 diff -u -p -r1.54 c-typeprint.c --- c-typeprint.c 9 Mar 2010 18:09:07 -0000 1.54 +++ c-typeprint.c 26 Mar 2010 22:13:08 -0000 @@ -416,8 +416,8 @@ c_type_print_args (struct type *type, st } } else if (!printed_any - && (TYPE_PROTOTYPED (type) - || current_language->la_language == language_cplus)) + && ((TYPE_PROTOTYPED (type) && language != language_java) + || language == language_cplus)) fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); @@ -616,7 +616,7 @@ c_type_print_varspec_suffix (struct type if (passed_a_ptr) fprintf_filtered (stream, ")"); if (!demangled_args) - c_type_print_args (type, stream, 1, language_c); + c_type_print_args (type, stream, 1, current_language->la_language); c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show, passed_a_ptr, 0); break; Index: jv-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/jv-typeprint.c,v retrieving revision 1.17 diff -u -p -r1.17 jv-typeprint.c --- jv-typeprint.c 1 Jan 2010 07:31:36 -0000 1.17 +++ jv-typeprint.c 26 Mar 2010 22:13:08 -0000 @@ -28,6 +28,7 @@ #include "typeprint.h" #include "c-lang.h" #include "cp-abi.h" +#include "gdb_assert.h" /* Local functions */ @@ -219,10 +220,19 @@ java_type_print_base (struct type *type, for (j = 0; j < n_overloads; j++) { - char *physname; + char *real_physname, *physname, *p; int is_full_physname_constructor; - physname = TYPE_FN_FIELD_PHYSNAME (f, j); + real_physname = TYPE_FN_FIELD_PHYSNAME (f, j); + + /* The physname will contain the return type + after the final closing parenthesis. Strip it off. */ + p = strrchr (real_physname, ')'); + gdb_assert (p != NULL); + ++p; /* Keep the trailing ')'. */ + physname = alloca (p - real_physname + 1); + memcpy (physname, real_physname, p - real_physname); + physname[p - real_physname] = '\0'; is_full_physname_constructor = (is_constructor_name (physname) @@ -268,7 +278,7 @@ java_type_print_base (struct type *type, /* Build something we can demangle. */ mangled_name = gdb_mangle_name (type, i, j); else - mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); + mangled_name = physname; demangled_name = cplus_demangle (mangled_name, Index: testsuite/gdb.java/jmisc.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.exp,v retrieving revision 1.15 diff -u -p -r1.15 jmisc.exp --- testsuite/gdb.java/jmisc.exp 9 Mar 2010 18:08:04 -0000 1.15 +++ testsuite/gdb.java/jmisc.exp 26 Mar 2010 22:13:08 -0000 @@ -79,6 +79,8 @@ if ![set_lang_java] then { gdb_expect { -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" } + -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" + { pass "ptype jmisc" } -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\)void;\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { # Just because GCC includes the signature doesn't mean we # should print it here. We already show the return type.