* remote-utils.c (putpkt_binary_1): Call readchar instead of read.
[deliverable/binutils-gdb.git] / gdb / jv-typeprint.c
index cc0f2bb7ed428cbb31ad9b42a403fb06976ff833..6132576a4fb8c7ecfdd32e3d254b341f9c68cfb4 100644 (file)
@@ -1,5 +1,6 @@
 /* Support for printing Java types for GDB, the GNU debugger.
-   Copyright (C) 1997, 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,6 +28,7 @@
 #include "typeprint.h"
 #include "c-lang.h"
 #include "cp-abi.h"
+#include "gdb_assert.h"
 
 /* Local functions */
 
@@ -184,7 +186,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
                    fprintf_filtered (stream, "public ");
                }
 
-             if (TYPE_FIELD_STATIC (type, i))
+             if (field_is_static (&TYPE_FIELD (type, i)))
                fprintf_filtered (stream, "static ");
 
              java_print_type (TYPE_FIELD_TYPE (type, i),
@@ -218,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)
@@ -267,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.024352 seconds and 4 git commands to generate.