* gdbarch.sh: Document the return_value method. Explain that
[deliverable/binutils-gdb.git] / gdb / ada-typeprint.c
index 39a47f97aad4ae3c521d08097db3989a4bfccaac..4b1f9ffc90d90b84bcb571f41ecff7f0cd15de43 100644 (file)
@@ -1,22 +1,21 @@
 /* Support for printing Ada types for GDB, the GNU debugger.
 /* Support for printing Ada types for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 
-   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004, 2007, 2008 Free Software Foundation, Inc.
 
 
-This file is part of GDB.
+   This file is part of GDB.
 
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "gdb_obstack.h"
 
 #include "defs.h"
 #include "gdb_obstack.h"
@@ -160,7 +159,7 @@ print_range (struct type *type, struct ui_file *stream)
          than 2, just print the type name instead of the range itself.
          This check handles cases such as characters, for example.
 
          than 2, just print the type name instead of the range itself.
          This check handles cases such as characters, for example.
 
-         Note that if the name is not defined, then we don't print anything.
+         If the name is not defined, then we don't print anything.
        */
       fprintf_filtered (stream, "%.*s",
                        ada_name_prefix_len (TYPE_NAME (type)),
        */
       fprintf_filtered (stream, "%.*s",
                        ada_name_prefix_len (TYPE_NAME (type)),
@@ -367,6 +366,9 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
   int bitsize;
   int n_indices;
 
   int bitsize;
   int n_indices;
 
+  if (ada_is_packed_array_type (type))
+    type = ada_coerce_to_simple_array_type (type);
+
   bitsize = 0;
   fprintf_filtered (stream, "array (");
 
   bitsize = 0;
   fprintf_filtered (stream, "array (");
 
@@ -375,11 +377,9 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
     fprintf_filtered (stream, "...");
   else
     {
     fprintf_filtered (stream, "...");
   else
     {
-      if (ada_is_packed_array_type (type))
-       type = ada_coerce_to_simple_array_type (type);
       if (type == NULL)
         {
       if (type == NULL)
         {
-          fprintf_filtered (stream, "<undecipherable array type>");
+          fprintf_filtered (stream, _("<undecipherable array type>"));
           return;
         }
       if (ada_is_simple_array_type (type))
           return;
         }
       if (ada_is_simple_array_type (type))
@@ -754,7 +754,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
                int show, int level)
 {
   struct type *type = ada_check_typedef (ada_get_base_type (type0));
                int show, int level)
 {
   struct type *type = ada_check_typedef (ada_get_base_type (type0));
-  char *type_name = decoded_type_name (type);
+  char *type_name = decoded_type_name (type0);
   int is_var_decl = (varstring != NULL && varstring[0] != '\0');
 
   if (type == NULL)
   int is_var_decl = (varstring != NULL && varstring[0] != '\0');
 
   if (type == NULL)
@@ -783,7 +783,17 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
   if (ada_is_aligner_type (type))
     ada_print_type (ada_aligned_type (type), "", stream, show, level);
   else if (ada_is_packed_array_type (type))
   if (ada_is_aligner_type (type))
     ada_print_type (ada_aligned_type (type), "", stream, show, level);
   else if (ada_is_packed_array_type (type))
-    print_array_type (type, stream, show, level);
+    {
+      if (TYPE_CODE (type) == TYPE_CODE_PTR)
+        {
+          fprintf_filtered (stream, "access ");
+          print_array_type (TYPE_TARGET_TYPE (type), stream, show, level);
+        }
+      else
+        {
+          print_array_type (type, stream, show, level);
+        }
+    }
   else
     switch (TYPE_CODE (type))
       {
   else
     switch (TYPE_CODE (type))
       {
@@ -812,7 +822,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
          {
            char *name = ada_type_name (type);
            if (!ada_is_range_type_name (name))
          {
            char *name = ada_type_name (type);
            if (!ada_is_range_type_name (name))
-             fprintf_filtered (stream, "<%d-byte integer>",
+             fprintf_filtered (stream, _("<%d-byte integer>"),
                                TYPE_LENGTH (type));
            else
              {
                                TYPE_LENGTH (type));
            else
              {
@@ -827,7 +837,8 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
        else if (ada_is_vax_floating_type (type))
          print_vax_floating_point_type (type, stream);
        else if (ada_is_modular_type (type))
        else if (ada_is_vax_floating_type (type))
          print_vax_floating_point_type (type, stream);
        else if (ada_is_modular_type (type))
-         fprintf_filtered (stream, "mod %ld", (long) ada_modulus (type));
+         fprintf_filtered (stream, "mod %s", 
+                           int_string (ada_modulus (type), 10, 0, 0, 1));
        else
          {
            fprintf_filtered (stream, "range ");
        else
          {
            fprintf_filtered (stream, "range ");
@@ -835,7 +846,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
          }
        break;
       case TYPE_CODE_FLT:
          }
        break;
       case TYPE_CODE_FLT:
-       fprintf_filtered (stream, "<%d-byte float>", TYPE_LENGTH (type));
+       fprintf_filtered (stream, _("<%d-byte float>"), TYPE_LENGTH (type));
        break;
       case TYPE_CODE_ENUM:
        if (show < 0)
        break;
       case TYPE_CODE_ENUM:
        if (show < 0)
@@ -848,7 +859,7 @@ ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
          print_array_type (type, stream, show, level);
        else if (ada_is_bogus_array_descriptor (type))
          fprintf_filtered (stream,
          print_array_type (type, stream, show, level);
        else if (ada_is_bogus_array_descriptor (type))
          fprintf_filtered (stream,
-                           "array (?) of ? (<mal-formed descriptor>)");
+                           _("array (?) of ? (<mal-formed descriptor>)"));
        else
          print_record_type (type, stream, show, level);
        break;
        else
          print_record_type (type, stream, show, level);
        break;
This page took 0.027681 seconds and 4 git commands to generate.