* remote-utils.c (putpkt_binary_1): Call readchar instead of read.
[deliverable/binutils-gdb.git] / gdb / jv-typeprint.c
index 43995babacf37d54881f8f1d4908100dc5b027b9..6132576a4fb8c7ecfdd32e3d254b341f9c68cfb4 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Java types for GDB, the GNU debugger.
-   Copyright (C) 1997, 1998, 1999, 2000, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2000, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -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, struct ui_file *stream, int show,
 
              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, struct ui_file *stream, int show,
                    /* 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,
This page took 0.023892 seconds and 4 git commands to generate.