* gdbtypes.h (struct main_type): Change type of name,tag_name,
[deliverable/binutils-gdb.git] / gdb / p-typeprint.c
index 54a761d464a0bb1bf6443f7de477802d483e4e4b..ab82d900391e94878a18e9d2b997fde55ad91676 100644 (file)
@@ -1,6 +1,5 @@
 /* Support for printing Pascal types for GDB, the GNU debugger.
-   Copyright (C) 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2006-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -31,7 +30,7 @@
 #include "language.h"
 #include "p-lang.h"
 #include "typeprint.h"
-
+#include "gdb-demangle.h"
 #include "gdb_string.h"
 #include <errno.h>
 #include <ctype.h>
@@ -132,7 +131,7 @@ pascal_print_typedef (struct type *type, struct symbol *new_symbol,
 static void
 pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
 {
-  char *name;
+  const char *name;
   int i;
 
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
@@ -153,7 +152,7 @@ pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
 /* Print the Pascal method arguments ARGS to the file STREAM.  */
 
 void
-pascal_type_print_method_args (char *physname, char *methodname,
+pascal_type_print_method_args (const char *physname, const char *methodname,
                               struct ui_file *stream)
 {
   int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
@@ -173,8 +172,7 @@ pascal_type_print_method_args (char *physname, char *methodname,
       while (isdigit (physname[0]))
        {
          int len = 0;
-         int i;
-         char storec;
+         int i, j;
          char *argname;
 
          while (isdigit (physname[len]))
@@ -183,10 +181,11 @@ pascal_type_print_method_args (char *physname, char *methodname,
            }
          i = strtol (physname, &argname, 0);
          physname += len;
-         storec = physname[i];
-         physname[i] = 0;
+
+         for (j = 0; j < i; ++j)
+           fputc_filtered (physname[i], stream);
          fputs_filtered (physname, stream);
-         physname[i] = storec;
+
          physname += i;
          if (physname[0] != 0)
            {
@@ -631,14 +630,14 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
            {
              struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
              int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
-             char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+             const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
 
              /* this is GNU C++ specific
                 how can we know constructor/destructor?
                 It might work for GNU pascal.  */
              for (j = 0; j < len2; j++)
                {
-                 char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+                 const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
 
                  int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
                  int is_destructor = (strncmp (physname, "__dt__", 6) == 0);
This page took 0.039437 seconds and 4 git commands to generate.